Add early return in yTimeRange when yAmount <= 1 to prevent division by zero

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-09 16:31:29 +08:00
parent 14c112cec5
commit 5bb89a631d

View File

@@ -165,6 +165,7 @@ export function timeRange(minTime, maxTime, amount) {
* @returns {Array<number>} 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);