Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/opts.js
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,12 @@ export function numAxisSplits(self, axisIdx, scaleMin, scaleMax, foundIncr, foun

scaleMin = forceMin ? scaleMin : roundDec(incrRoundUp(scaleMin, foundIncr), numDec);

if (scaleMin === scaleMax)
throw new RangeError("scaleMin cannot be equal to scaleMax");

if (roundDec(scaleMin + foundIncr, numDec) === scaleMin)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the only sus thing from the perspective of performance I think. in reality, it's one extra round beyond the rounding the method already does as part of the below for loop, so it seems negligible for the benefit.

throw new RangeError("foundIncr too small for scaleMin");

for (let val = scaleMin; val <= scaleMax; val = roundDec(val + foundIncr, numDec))
splits.push(Object.is(val, -0) ? 0 : val); // coalesces -0

Expand Down Expand Up @@ -841,4 +847,4 @@ export const xScaleOpts = {
export const yScaleOpts = assign({}, xScaleOpts, {
time: false,
ori: 1,
});
});