diff --git a/packages/charts/src/chart_types/metric/renderer/dom/sparkline.tsx b/packages/charts/src/chart_types/metric/renderer/dom/sparkline.tsx index f2b46ade6f..862094bd3e 100644 --- a/packages/charts/src/chart_types/metric/renderer/dom/sparkline.tsx +++ b/packages/charts/src/chart_types/metric/renderer/dom/sparkline.tsx @@ -53,12 +53,11 @@ export const SparkLine: FunctionComponent<{ const sortedTrendData = getSortedData(trend); const xMin = sortedTrendData.at(0)?.x ?? NaN; const xMax = sortedTrendData.at(-1)?.x ?? NaN; - const [yMin, yMax] = extent(sortedTrendData.map((d) => d.y)); + const [, yMax] = extent(sortedTrendData.map((d) => d.y)); const xScale = (value: number) => (value - xMin) / (xMax - xMin); const yScale = (value: number) => value / yMax; - // diff between min and max values should be a finite value - const shouldVisualizePath = Math.abs(xMax - xMin) && Math.abs(yMax - yMin); + const shouldVisualizePath = Math.abs(xMax - xMin) && yMax; const path = shouldVisualizePath ? areaGenerator<{ x: number; y: number }>(