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:
parent
5d23a9c5e1
commit
2d96becb28
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user