mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-31 13:47:02 +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:
parent
5d23a9c5e1
commit
2d96becb28
@ -90,6 +90,9 @@ export const ImpactMetricsChart: FC<ImpactMetricsChartProps> = ({
|
||||
description=''
|
||||
/>
|
||||
);
|
||||
|
||||
const hasManyLabels = Object.keys(selectedLabels).length > 0;
|
||||
|
||||
const cover = notEnoughData ? placeholder : isLoading;
|
||||
|
||||
const chartOptions = shouldShowPlaceholder
|
||||
@ -132,7 +135,9 @@ export const ImpactMetricsChart: FC<ImpactMetricsChartProps> = ({
|
||||
},
|
||||
plugins: {
|
||||
legend: {
|
||||
display: timeSeriesData && timeSeriesData.length > 1,
|
||||
display:
|
||||
timeSeriesData &&
|
||||
(hasManyLabels || timeSeriesData.length > 1),
|
||||
position: 'bottom' as const,
|
||||
labels: {
|
||||
usePointStyle: true,
|
||||
|
Loading…
Reference in New Issue
Block a user