From 9079224cb3cc567ed17adaf2a0743a3b2035c270 Mon Sep 17 00:00:00 2001 From: Sean Kelly Date: Sun, 28 Apr 2024 21:22:09 -0700 Subject: [PATCH] Add label to y axis and adjust step size if percentage --- web/src/components/graph/SystemGraph.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/src/components/graph/SystemGraph.tsx b/web/src/components/graph/SystemGraph.tsx index e96ce8235..bb00394bb 100644 --- a/web/src/components/graph/SystemGraph.tsx +++ b/web/src/components/graph/SystemGraph.tsx @@ -123,9 +123,10 @@ export function ThresholdBarGraph({ yaxis: { show: true, labels: { - formatter: (val: number) => Math.ceil(val).toString(), + formatter: (val: number) => `${Math.ceil(val)}${unit}`, }, min: 0, + stepSize: unit === "%" ? 5 : undefined, }, } as ApexCharts.ApexOptions; }, [graphId, threshold, unit, systemTheme, theme, formatTime]); @@ -365,9 +366,10 @@ export function CameraLineGraph({ yaxis: { show: true, labels: { - formatter: (val: number) => Math.ceil(val).toString(), + formatter: (val: number) => `${Math.ceil(val)}${unit}`, }, min: 0, + stepSize: unit === "%" ? 5 : undefined, }, } as ApexCharts.ApexOptions; }, [graphId, systemTheme, theme, formatTime]);