1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-08-04 13:48:56 +02:00

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
This commit is contained in:
Tymoteusz Czech 2025-07-17 16:26:24 +02:00 committed by GitHub
parent 5d23a9c5e1
commit 2d96becb28
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -90,6 +90,9 @@ export const ImpactMetricsChart: FC<ImpactMetricsChartProps> = ({
description='' description=''
/> />
); );
const hasManyLabels = Object.keys(selectedLabels).length > 0;
const cover = notEnoughData ? placeholder : isLoading; const cover = notEnoughData ? placeholder : isLoading;
const chartOptions = shouldShowPlaceholder const chartOptions = shouldShowPlaceholder
@ -132,7 +135,9 @@ export const ImpactMetricsChart: FC<ImpactMetricsChartProps> = ({
}, },
plugins: { plugins: {
legend: { legend: {
display: timeSeriesData && timeSeriesData.length > 1, display:
timeSeriesData &&
(hasManyLabels || timeSeriesData.length > 1),
position: 'bottom' as const, position: 'bottom' as const,
labels: { labels: {
usePointStyle: true, usePointStyle: true,