Fix chart styles + date not matching Closes #1518

This commit is contained in:
Kalle
2023-12-30 12:59:47 +02:00
parent 3a44ed81d9
commit f7bc6c14f3

View File

@@ -19,6 +19,7 @@ export default function Chart({
headerSuffix?: string;
valueSuffix?: string;
}) {
const { i18n } = useTranslation();
const theme = useTheme();
const isMounted = useIsMounted();
@@ -27,8 +28,18 @@ export default function Chart({
>(
() => ({
getValue: (datum) => datum.primary,
scaleType: "localTime",
shouldNice: false,
formatters: {
scale: (val) => {
return val.toLocaleDateString(i18n.language, {
day: "numeric",
month: "numeric",
});
},
},
}),
[],
[i18n.language],
);
const secondaryAxes = React.useMemo<
@@ -60,6 +71,8 @@ export default function Chart({
/>
),
},
primaryCursor: false,
secondaryCursor: false,
primaryAxis,
secondaryAxes,
dark: theme.htmlThemeClass === Theme.DARK,