Make tooltip match theme

This commit is contained in:
Nicolas Mowen 2024-04-03 15:28:44 -06:00
parent cb34ac5026
commit 25f001bf47

View File

@ -1,3 +1,4 @@
import { useTheme } from "@/context/theme-provider";
import { Threshold } from "@/types/graph";
import { useCallback, useEffect, useMemo } from "react";
import Chart from "react-apexcharts";
@ -24,6 +25,8 @@ export default function SystemGraph({
[data],
);
const { theme, systemTheme } = useTheme();
const formatTime = useCallback(
(val: unknown) => {
const date = new Date(updateTimes[Math.round(val as number)] * 1000);
@ -71,6 +74,9 @@ export default function SystemGraph({
distributed: true,
},
},
tooltip: {
theme: systemTheme || theme,
},
xaxis: {
tickAmount: 6,
labels: {
@ -88,7 +94,7 @@ export default function SystemGraph({
max: lastValue * 2,
},
};
}, [graphId, lastValue, threshold, formatTime]);
}, [graphId, lastValue, threshold, systemTheme, theme, formatTime]);
useEffect(() => {
ApexCharts.exec(graphId, "updateOptions", options, true, true);