mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-22 09:57:00 +01:00
Fixed legend not updating correctly.
This commit is contained in:
parent
6767f95c0d
commit
a695f6d516
@ -81,6 +81,7 @@ export function Chart({
|
|||||||
const updateChart = (data: any) => {
|
const updateChart = (data: any) => {
|
||||||
chart.current.data.datasets.forEach((dataset: { data: any }, index: string | number) => {
|
chart.current.data.datasets.forEach((dataset: { data: any }, index: string | number) => {
|
||||||
dataset.data = data?.datasets[index]?.data;
|
dataset.data = data?.datasets[index]?.data;
|
||||||
|
chart.current.legend.legendItems[index].text = data?.datasets[index].label;
|
||||||
});
|
});
|
||||||
|
|
||||||
chart.current.options = options;
|
chart.current.options = options;
|
||||||
@ -88,9 +89,9 @@ export function Chart({
|
|||||||
// Allow config changes before update
|
// Allow config changes before update
|
||||||
onUpdate?.(chart.current);
|
onUpdate?.(chart.current);
|
||||||
|
|
||||||
chart.current.update(updateMode);
|
|
||||||
|
|
||||||
setLegendItems(chart.current.legend.legendItems);
|
setLegendItems(chart.current.legend.legendItems);
|
||||||
|
|
||||||
|
chart.current.update(updateMode);
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -38,7 +38,7 @@ export function PageviewsChart({ data, unit, isLoading, ...props }: PageviewsCha
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
}, [data]);
|
}, [data, locale]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BarChart
|
<BarChart
|
||||||
|
@ -63,6 +63,7 @@
|
|||||||
title: encode(title),
|
title: encode(title),
|
||||||
url: encode(currentUrl),
|
url: encode(currentUrl),
|
||||||
referrer: encode(currentRef),
|
referrer: encode(currentRef),
|
||||||
|
tag: tag ? tag : undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Event handlers */
|
/* Event handlers */
|
||||||
@ -217,7 +218,6 @@
|
|||||||
...getPayload(),
|
...getPayload(),
|
||||||
name: obj,
|
name: obj,
|
||||||
data: typeof data === 'object' ? data : undefined,
|
data: typeof data === 'object' ? data : undefined,
|
||||||
tag,
|
|
||||||
});
|
});
|
||||||
} else if (typeof obj === 'object') {
|
} else if (typeof obj === 'object') {
|
||||||
return send(obj);
|
return send(obj);
|
||||||
|
Loading…
Reference in New Issue
Block a user