From 5bb89a631d64d85414484fa0af9ef2f35d0550b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Mon, 9 Mar 2026 16:31:29 +0800 Subject: [PATCH] Add early return in yTimeRange when yAmount <= 1 to prevent division by zero Co-Authored-By: Claude Opus 4.6 --- src/module/setChartData.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/module/setChartData.js b/src/module/setChartData.js index 797c6b5..23054c6 100644 --- a/src/module/setChartData.js +++ b/src/module/setChartData.js @@ -165,6 +165,7 @@ export function timeRange(minTime, maxTime, amount) { * @returns {Array} An array of interpolated Y values. */ export function yTimeRange(data, yAmount, yMax) { + if (yAmount <= 1) return data.map((d) => d.y); const yRange = []; const yGap = 1 / (yAmount - 1);