mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 06:07:17 +01:00
Fixed legend not updating correctly.
This commit is contained in:
parent
6767f95c0d
commit
a695f6d516
3 changed files with 5 additions and 4 deletions
|
|
@ -81,6 +81,7 @@ export function Chart({
|
|||
const updateChart = (data: any) => {
|
||||
chart.current.data.datasets.forEach((dataset: { data: any }, index: string | number) => {
|
||||
dataset.data = data?.datasets[index]?.data;
|
||||
chart.current.legend.legendItems[index].text = data?.datasets[index].label;
|
||||
});
|
||||
|
||||
chart.current.options = options;
|
||||
|
|
@ -88,9 +89,9 @@ export function Chart({
|
|||
// Allow config changes before update
|
||||
onUpdate?.(chart.current);
|
||||
|
||||
chart.current.update(updateMode);
|
||||
|
||||
setLegendItems(chart.current.legend.legendItems);
|
||||
|
||||
chart.current.update(updateMode);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ export function PageviewsChart({ data, unit, isLoading, ...props }: PageviewsCha
|
|||
},
|
||||
],
|
||||
};
|
||||
}, [data]);
|
||||
}, [data, locale]);
|
||||
|
||||
return (
|
||||
<BarChart
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue