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:
@@ -165,6 +165,7 @@ export function timeRange(minTime, maxTime, amount) {
|
|||||||
* @returns {Array<number>} An array of interpolated Y values.
|
* @returns {Array<number>} An array of interpolated Y values.
|
||||||
*/
|
*/
|
||||||
export function yTimeRange(data, yAmount, yMax) {
|
export function yTimeRange(data, yAmount, yMax) {
|
||||||
|
if (yAmount <= 1) return data.map((d) => d.y);
|
||||||
const yRange = [];
|
const yRange = [];
|
||||||
const yGap = 1 / (yAmount - 1);
|
const yGap = 1 / (yAmount - 1);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user