From 4a64b6ad6c6a25fcf6a364a67473c1e476059b93 Mon Sep 17 00:00:00 2001 From: Alexey Antonov Date: Thu, 30 May 2024 18:23:23 +0300 Subject: [PATCH] fix (Metric): chart not rendered when the trend is empty Closes: https://github.com/elastic/elastic-charts/issues/2445 --- .../charts/src/chart_types/metric/renderer/dom/sparkline.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 977dc0888d..d508bd5441 100644 --- a/packages/charts/src/chart_types/metric/renderer/dom/sparkline.tsx +++ b/packages/charts/src/chart_types/metric/renderer/dom/sparkline.tsx @@ -50,7 +50,7 @@ export const SparkLine: FunctionComponent<{ id: string; datum: MetricWTrend; }> = ({ id, datum: { color, trend, trendA11yTitle, trendA11yDescription, trendShape } }) => { - if (!trend) { + if (!trend?.length) { return null; } const sortedTrendData = getSortedData(trend);