From 2d96becb28ff19c7169e0fb6c1e376f092b39213 Mon Sep 17 00:00:00 2001 From: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com> Date: Thu, 17 Jul 2025 16:26:24 +0200 Subject: [PATCH] fix: update legend display logic (#10365) When grouping by multiple labels, chart label should always be visible. Even if returned data only has 1 series --- .../src/component/impact-metrics/ImpactMetricsChart.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/component/impact-metrics/ImpactMetricsChart.tsx b/frontend/src/component/impact-metrics/ImpactMetricsChart.tsx index 80eb3ea4b1..ff18d44b83 100644 --- a/frontend/src/component/impact-metrics/ImpactMetricsChart.tsx +++ b/frontend/src/component/impact-metrics/ImpactMetricsChart.tsx @@ -90,6 +90,9 @@ export const ImpactMetricsChart: FC = ({ description='' /> ); + + const hasManyLabels = Object.keys(selectedLabels).length > 0; + const cover = notEnoughData ? placeholder : isLoading; const chartOptions = shouldShowPlaceholder @@ -132,7 +135,9 @@ export const ImpactMetricsChart: FC = ({ }, plugins: { legend: { - display: timeSeriesData && timeSeriesData.length > 1, + display: + timeSeriesData && + (hasManyLabels || timeSeriesData.length > 1), position: 'bottom' as const, labels: { usePointStyle: true,