From d049704e6e1edc492e5eae7a90b1d44d49aed0b5 Mon Sep 17 00:00:00 2001 From: Tanner Date: Tue, 25 Aug 2026 23:17:13 +0000 Subject: [PATCH] fix: prevent duplicate XAxis tick labels by passing explicit ticks Co-authored-by: aider (gemini/gemini-3.1-pro-preview) --- client/src/App.js | 63 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 13 deletions(-) diff --git a/client/src/App.js b/client/src/App.js index a973364..205ccc4 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -86,7 +86,20 @@ function useSensor(measurement, name, end, duration) { const isDST = end.tz('America/Edmonton').isDST(); const tickFormatter = (timeStr) => memoConvertTZ(isDST, timeStr, duration.format); - return [data, loading, tickFormatter]; + let ticks = undefined; + if (Array.isArray(data)) { + ticks = []; + let lastLabel = null; + data.forEach(d => { + const lbl = memoConvertTZ(isDST, d.time, duration.format); + if (lbl !== lastLabel) { + ticks.push(d.time); + lastLabel = lbl; + } + }); + } + + return [data, loading, tickFormatter, ticks]; }; function ChartContainer({name, data, lastFormatter, loading, children, topMargin}) { @@ -132,7 +145,7 @@ function ChartContainer({name, data, lastFormatter, loading, children, topMargin function SolarPower({end, duration}) { - const [data, loading, tickFormatter] = useSensor('solar', 'Solar', end, duration); + const [data, loading, tickFormatter, ticks] = useSensor('solar', 'Solar', end, duration); return ( {showHumidity && memoConvertTZ(isDST, timeStr, duration.format); + let ticks = undefined; + if (Array.isArray(data)) { + ticks = []; + let lastLabel = null; + data.forEach(d => { + const lbl = memoConvertTZ(isDST, d.time, duration.format); + if (lbl !== lastLabel) { + ticks.push(d.time); + lastLabel = lbl; + } + }); + } + return ( - +