Fix division by zero in timeRange when amount is 1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-09 14:20:05 +08:00
parent 8a4b6539b9
commit adbb90eeea

View File

@@ -142,6 +142,7 @@ export function setBarChartData(baseData) {
* values in seconds. * values in seconds.
*/ */
export function timeRange(minTime, maxTime, amount) { export function timeRange(minTime, maxTime, amount) {
if (amount <= 1) return [Math.round(minTime)];
// The X-axis (time axis) range is max - min; accumulate intervals from min to max by index // The X-axis (time axis) range is max - min; accumulate intervals from min to max by index
const startTime = minTime; const startTime = minTime;
const endTime = maxTime; const endTime = maxTime;