mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 15:17:23 +01:00
Localize x axis labels. Closes #1913
This commit is contained in:
parent
083a9ffc2c
commit
cc20f898b1
3 changed files with 38 additions and 7 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import { useEffect } from 'react';
|
||||
import { StatusLight } from 'react-basics';
|
||||
import { colord } from 'colord';
|
||||
import classNames from 'classnames';
|
||||
|
|
@ -9,7 +10,7 @@ export default function Legend({ chart }) {
|
|||
const { locale } = useLocale();
|
||||
const forceUpdate = useForceUpdate();
|
||||
|
||||
function handleClick(index) {
|
||||
const handleClick = index => {
|
||||
const meta = chart.getDatasetMeta(index);
|
||||
|
||||
meta.hidden = meta.hidden === null ? !chart.data.datasets[index].hidden : null;
|
||||
|
|
@ -17,7 +18,11 @@ export default function Legend({ chart }) {
|
|||
chart.update();
|
||||
|
||||
forceUpdate();
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
forceUpdate();
|
||||
}, [locale]);
|
||||
|
||||
if (!chart?.legend?.legendItems.find(({ text }) => text)) {
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue