How to use the @elastic/charts.niceTimeFormatter 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 / siem / public / components / matrix_over_time / index.tsx View on Github external
const getBarchartConfigs = (from: number, to: number, onBrushEnd: UpdateDateRange) => ({
  series: {
    xScaleType: ScaleType.Time,
    yScaleType: ScaleType.Linear,
    stackAccessors: ['g'],
  },
  axis: {
    xTickFormatter: niceTimeFormatter([from, to]),
    yTickFormatter: (value: string | number): string => value.toLocaleString(),
    tickSize: 8,
  },
  settings: {
    legendPosition: Position.Bottom,
    onBrushEnd,
    showLegend: true,
    theme: {
      scales: {
        barsPadding: 0.08,
      },
      chartMargins: {
        left: 0,
        right: 0,
        top: 0,
        bottom: 0,
github elastic / kibana / x-pack / legacy / plugins / ml / public / datavisualizer / index_based / components / field_data_card / document_count_chart / document_count_chart.tsx View on Github external
width,
  height,
  chartPoints,
  timeRangeEarliest,
  timeRangeLatest,
}) => {
  const seriesName = i18n.translate('xpack.ml.fieldDataCard.documentCountChart.seriesLabel', {
    defaultMessage: 'document count',
  });

  const xDomain = {
    min: timeRangeEarliest,
    max: timeRangeLatest,
  };

  const dateFormatter = niceTimeFormatter([timeRangeEarliest, timeRangeLatest]);

  const IS_DARK_THEME = useUiChromeContext()
    .getUiSettingsClient()
    .get('theme:darkMode');
  const themeName = IS_DARK_THEME ? darkTheme : lightTheme;
  const EVENT_RATE_COLOR = themeName.euiColorVis2;

  return (
    <div height="" style="{{">
      
        </div>
github elastic / kibana / x-pack / legacy / plugins / infra / public / pages / metrics / components / chart_section_vis.tsx View on Github external
    () => (metric != null ? niceTimeFormatter(getMaxMinTimestamp(metric)) : undefined),
    [metric]
github elastic / kibana / x-pack / legacy / plugins / siem / public / components / stat_items / index.tsx View on Github external
{(enableAreaChart || enableBarChart) &amp;&amp; }
          
            {enableBarChart &amp;&amp; (
              
                
              
            )}

            {enableAreaChart &amp;&amp; from != null &amp;&amp; to != null &amp;&amp; (
              
                
              
            )}
          
        
      
    );
  }
);
github elastic / kibana / x-pack / legacy / plugins / lens / public / indexpattern_plugin / field_item.tsx View on Github external
fromDate &amp;&amp; toDate
                ? {
                    min: fromDate.valueOf(),
                    max: toDate.valueOf(),
                    minInterval: Math.round((toDate.valueOf() - fromDate.valueOf()) / 10),
                  }
                : undefined
            }
          /&gt;