How to use the @elastic/charts.ScaleType.Time function in @elastic/charts

To help you get started, we’ve selected a few @elastic/charts 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 elastic / kibana / x-pack / legacy / plugins / lens / public / xy_visualization_plugin / to_expression.ts View on Github external
export function getScaleType(metadata: OperationMetadata | null, defaultScale: ScaleType) {
  if (!metadata) {
    return defaultScale;
  }

  // use scale information if available
  if (metadata.scale === 'ordinal') {
    return ScaleType.Ordinal;
  }
  if (metadata.scale === 'interval' || metadata.scale === 'ratio') {
    return metadata.dataType === 'date' ? ScaleType.Time : ScaleType.Linear;
  }

  // fall back to data type if necessary
  switch (metadata.dataType) {
    case 'boolean':
    case 'string':
      return ScaleType.Ordinal;
    case 'date':
      return ScaleType.Time;
    default:
      return ScaleType.Linear;
  }
}
github elastic / kibana / x-pack / legacy / plugins / lens / public / xy_visualization_plugin / to_expression.ts View on Github external
// use scale information if available
  if (metadata.scale === 'ordinal') {
    return ScaleType.Ordinal;
  }
  if (metadata.scale === 'interval' || metadata.scale === 'ratio') {
    return metadata.dataType === 'date' ? ScaleType.Time : ScaleType.Linear;
  }

  // fall back to data type if necessary
  switch (metadata.dataType) {
    case 'boolean':
    case 'string':
      return ScaleType.Ordinal;
    case 'date':
      return ScaleType.Time;
    default:
      return ScaleType.Linear;
  }
}
github elastic / kibana / x-pack / legacy / plugins / uptime / public / components / functional / charts / duration_chart.tsx View on Github external
const lineSeries = locationDurationLines.map(line => {
    const locationSpecId = getSpecId('loc-avg' + line.name);
    return (
       [x || 0, microsToMillis(y)])}
        id={locationSpecId}
        key={`locline-${line.name}`}
        name={line.name}
        xAccessor={0}
        xScaleType={ScaleType.Time}
        yAccessors={[1]}
        yScaleToDataExtent={false}
        yScaleType={ScaleType.Linear}
      />
    );
  });
github elastic / kibana / src / legacy / core_plugins / kibana / public / discover / np_ready / angular / directives / histogram.tsx View on Github external
annotationId={getAnnotationId('line-annotation')}
          domainType={AnnotationDomainTypes.XDomain}
          dataValues={lineAnnotationData}
          hideTooltips={true}
          style={lineAnnotationStyle}
        />
        
        
      
    );
  }
}
github elastic / kibana / x-pack / legacy / plugins / watcher / public / sections / watch_edit / components / threshold_watch_edit / watch_visualization.tsx View on Github external
{watchVisualizationDataKeys.map((key: string) => {
              return (
                
              );
            })}
            {actualThreshold.map((_value: any, i: number) => {
github elastic / kibana / x-pack / legacy / plugins / infra / public / components / metrics / sections / series_chart.tsx View on Github external
},
    rect: {
      opacity: 1,
    },
  };
  const colors: DataSeriesColorsValues = {
    colorValues: [],
    specId: getSpecId(id),
  };
  const customColors: CustomSeriesColorsMap = new Map();
  customColors.set(colors, color || '#999');
  return (
    
  );
};
github elastic / kibana / x-pack / legacy / plugins / siem / public / components / stat_items / index.tsx View on Github external
export const areachartConfigs = (config?: {
  xTickFormatter: (value: number) => string;
  onBrushEnd?: BrushEndListener;
}) => ({
  series: {
    xScaleType: ScaleType.Time,
    yScaleType: ScaleType.Linear,
  },
  axis: {
    xTickFormatter: get('xTickFormatter', config),
    yTickFormatter: numberFormatter,
  },
  settings: {
    onBrushEnd: getOr(() => {}, 'onBrushEnd', config),
  },
  customHeight: statItemChartCustomHeight,
});
github elastic / kibana / x-pack / legacy / plugins / ml / public / jobs / new_job / pages / components / charts / anomaly_chart / model_bounds.tsx View on Github external
export const ModelBounds: FC = ({ modelData }) => {
  const model = modelData === undefined ? [] : modelData;
  return (
    
  );
};