Show metrics correctly when hovering graph

This commit is contained in:
Nicolas Mowen 2024-04-14 09:38:29 -06:00
parent 34d7125e68
commit 5cc05ee859
2 changed files with 8 additions and 5 deletions

View File

@ -92,6 +92,9 @@ export function ThresholdBarGraph({
}, },
tooltip: { tooltip: {
theme: systemTheme || theme, theme: systemTheme || theme,
y: {
formatter: (val) => `${val}${unit}`,
},
}, },
markers: { markers: {
size: 0, size: 0,
@ -118,7 +121,7 @@ export function ThresholdBarGraph({
min: 0, min: 0,
}, },
} as ApexCharts.ApexOptions; } as ApexCharts.ApexOptions;
}, [graphId, threshold, systemTheme, theme, formatTime]); }, [graphId, threshold, unit, systemTheme, theme, formatTime]);
useEffect(() => { useEffect(() => {
ApexCharts.exec(graphId, "updateOptions", options, true, true); ApexCharts.exec(graphId, "updateOptions", options, true, true);

View File

@ -182,7 +182,7 @@ export default function GeneralMetrics({
series[key] = { name: key, data: [] }; series[key] = { name: key, data: [] };
} }
series[key].data.push({ x: statsIdx + 1, y: stats.gpu }); series[key].data.push({ x: statsIdx + 1, y: stats.gpu.slice(0, -1) });
}); });
}); });
return Object.keys(series).length > 0 ? Object.values(series) : []; return Object.keys(series).length > 0 ? Object.values(series) : [];
@ -215,7 +215,7 @@ export default function GeneralMetrics({
series[key] = { name: key, data: [] }; series[key] = { name: key, data: [] };
} }
series[key].data.push({ x: statsIdx + 1, y: stats.mem }); series[key].data.push({ x: statsIdx + 1, y: stats.mem.slice(0, -1) });
}); });
}); });
return Object.values(series); return Object.values(series);
@ -373,7 +373,7 @@ export default function GeneralMetrics({
key={series.name} key={series.name}
graphId={`${series.name}-gpu`} graphId={`${series.name}-gpu`}
name={series.name} name={series.name}
unit="" unit="%"
threshold={GPUUsageThreshold} threshold={GPUUsageThreshold}
updateTimes={updateTimes} updateTimes={updateTimes}
data={[series]} data={[series]}
@ -392,7 +392,7 @@ export default function GeneralMetrics({
<ThresholdBarGraph <ThresholdBarGraph
key={series.name} key={series.name}
graphId={`${series.name}-mem`} graphId={`${series.name}-mem`}
unit="" unit="%"
name={series.name} name={series.name}
threshold={GPUMemThreshold} threshold={GPUMemThreshold}
updateTimes={updateTimes} updateTimes={updateTimes}