How to use the @superset-ui/core.isDefined function in @superset-ui/core

To help you get started, we’ve selected a few @superset-ui/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apache / incubator-superset / superset / assets / src / modules / visUtils.js View on Github external
export function getTextDimension({
  text,
  className,
  style,
  container = document.body,
}) {
  const textNode = document.createElementNS(SVG_NS, 'text');
  textNode.textContent = text;

  if (isDefined(className)) {
    textNode.setAttribute('class', className);
  }

  if (isDefined(style)) {
    ['font', 'fontWeight', 'fontStyle', 'fontSize', 'fontFamily', 'letterSpacing']
      .filter(field => isDefined(style[field]))
      .forEach((field) => {
        textNode.style[field] = style[field];
      });
  }

  const svg = document.createElementNS(SVG_NS, 'svg');
  svg.style.position = 'absolute'; // so it won't disrupt page layout
  svg.style.opacity = 0;           // and not visible
  svg.appendChild(textNode);
  container.appendChild(svg);
github apache-superset / superset-ui / packages / superset-ui-chart / src / clients / ChartClient.ts View on Github external
loadAnnotation(annotationLayer: AnnotationLayerMetadata): Promise {
    /* When annotation does not require query */
    if (!isDefined(annotationLayer.sourceType)) {
      return Promise.resolve({});
    }

    // TODO: Implement
    return Promise.reject(new Error('This feature is not implemented yet.'));
  }
github apache-superset / superset-ui / packages / superset-ui-chart / src / clients / ChartClient.ts View on Github external
loadAnnotation(annotationLayer: AnnotationLayerMetadata): Promise {
    /* When annotation does not require query */
    if (!isDefined(annotationLayer.sourceType)) {
      return Promise.resolve({} as AnnotationData);
    }

    // TODO: Implement
    return Promise.reject(new Error('This feature is not implemented yet.'));
  }
github apache-superset / superset-ui-plugins / packages / superset-ui-preset-chart-xy / src / BoxPlot / DefaultTooltipRenderer.tsx View on Github external
if (isDefined(min)) {
    data.push({ key: 'Min', valueColumn: formatValue(min) });
  }
  if (isDefined(max)) {
    data.push({ key: 'Max', valueColumn: formatValue(max) });
  }
  if (isDefined(median)) {
    data.push({ key: 'Median', valueColumn: formatValue(median) });
  }
  if (isDefined(firstQuartile)) {
    data.push({ key: '1st Quartile', valueColumn: formatValue(firstQuartile) });
  }
  if (isDefined(thirdQuartile)) {
    data.push({ key: '3rd Quartile', valueColumn: formatValue(thirdQuartile) });
  }
  if (isDefined(outliers) && outliers.length > 0) {
    data.push({ key: '# Outliers', valueColumn: outliers.length });
  }

  return (
    
      <div>
        <strong color="" style="{{">{label}</strong>
      </div>
      {data.length &gt; 0 &amp;&amp; <br>}
      
    
  );
}
github apache-superset / superset-ui-plugins / packages / superset-ui-preset-chart-xy / src / BoxPlot / DefaultTooltipRenderer.tsx View on Github external
const { channels } = encoder;

  const formatValue =
    channels.y.definition.type === 'nominal' ? channels.x.formatValue : channels.y.formatValue;

  const data = [];
  if (isDefined(min)) {
    data.push({ key: 'Min', valueColumn: formatValue(min) });
  }
  if (isDefined(max)) {
    data.push({ key: 'Max', valueColumn: formatValue(max) });
  }
  if (isDefined(median)) {
    data.push({ key: 'Median', valueColumn: formatValue(median) });
  }
  if (isDefined(firstQuartile)) {
    data.push({ key: '1st Quartile', valueColumn: formatValue(firstQuartile) });
  }
  if (isDefined(thirdQuartile)) {
    data.push({ key: '3rd Quartile', valueColumn: formatValue(thirdQuartile) });
  }
  if (isDefined(outliers) &amp;&amp; outliers.length &gt; 0) {
    data.push({ key: '# Outliers', valueColumn: outliers.length });
  }

  return (
    
      <div>
        <strong color="" style="{{">{label}</strong>
      </div>
      {data.length &gt; 0 &amp;&amp; <br>}
github apache / incubator-superset / superset / assets / src / modules / visUtils.js View on Github external
      .filter(field => isDefined(style[field]))
      .forEach((field) => {
github apache-superset / superset-ui-plugins / packages / superset-ui-preset-chart-xy / src / BoxPlot / DefaultTooltipRenderer.tsx View on Github external
encoder: Encoder;
}) {
  const { label, min, max, median, firstQuartile, thirdQuartile, outliers } = datum;
  const { channels } = encoder;

  const formatValue =
    channels.y.definition.type === 'nominal' ? channels.x.formatValue : channels.y.formatValue;

  const data = [];
  if (isDefined(min)) {
    data.push({ key: 'Min', valueColumn: formatValue(min) });
  }
  if (isDefined(max)) {
    data.push({ key: 'Max', valueColumn: formatValue(max) });
  }
  if (isDefined(median)) {
    data.push({ key: 'Median', valueColumn: formatValue(median) });
  }
  if (isDefined(firstQuartile)) {
    data.push({ key: '1st Quartile', valueColumn: formatValue(firstQuartile) });
  }
  if (isDefined(thirdQuartile)) {
    data.push({ key: '3rd Quartile', valueColumn: formatValue(thirdQuartile) });
  }
  if (isDefined(outliers) &amp;&amp; outliers.length &gt; 0) {
    data.push({ key: '# Outliers', valueColumn: outliers.length });
  }

  return (
    
      <div>
        <strong color="" style="{{">{label}</strong></div>
github apache-superset / superset-ui-plugins / packages / superset-ui-preset-chart-xy / src / components / ChartFrame.tsx View on Github external
function checkNumber(input: any): input is number {
  return isDefined(input) && typeof input === 'number';
}
github apache-superset / superset-ui-plugins / packages / superset-ui-preset-chart-xy / src / BoxPlot / DefaultTooltipRenderer.tsx View on Github external
channels.y.definition.type === 'nominal' ? channels.x.formatValue : channels.y.formatValue;

  const data = [];
  if (isDefined(min)) {
    data.push({ key: 'Min', valueColumn: formatValue(min) });
  }
  if (isDefined(max)) {
    data.push({ key: 'Max', valueColumn: formatValue(max) });
  }
  if (isDefined(median)) {
    data.push({ key: 'Median', valueColumn: formatValue(median) });
  }
  if (isDefined(firstQuartile)) {
    data.push({ key: '1st Quartile', valueColumn: formatValue(firstQuartile) });
  }
  if (isDefined(thirdQuartile)) {
    data.push({ key: '3rd Quartile', valueColumn: formatValue(thirdQuartile) });
  }
  if (isDefined(outliers) &amp;&amp; outliers.length &gt; 0) {
    data.push({ key: '# Outliers', valueColumn: outliers.length });
  }

  return (
    
      <div>
        <strong color="" style="{{">{label}</strong>
      </div>
      {data.length &gt; 0 &amp;&amp; <br>}
      
    
  );
}