Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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,
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>
() => (metric != null ? niceTimeFormatter(getMaxMinTimestamp(metric)) : undefined),
[metric]
{(enableAreaChart || enableBarChart) && }
{enableBarChart && (
)}
{enableAreaChart && from != null && to != null && (
)}
);
}
);
fromDate && toDate
? {
min: fromDate.valueOf(),
max: toDate.valueOf(),
minInterval: Math.round((toDate.valueOf() - fromDate.valueOf()) / 10),
}
: undefined
}
/>