Skip to content

Commit

Permalink
Fix Maximum call stack size exception in _computeLabelSizes
Browse files Browse the repository at this point in the history
  • Loading branch information
silentmatt committed Oct 17, 2020
1 parent 30d09f4 commit b2c3203
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/core/core.scale.js
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,8 @@ export default class Scale extends Element {
const widths = [];
const heights = [];
const offsets = [];
let widestLabelSize = 0;
let highestLabelSize = 0;
let ticks = me.ticks;
if (sampleSize < ticks.length) {
ticks = sample(ticks, sampleSize);
Expand Down Expand Up @@ -926,11 +928,13 @@ export default class Scale extends Element {
widths.push(width);
heights.push(height);
offsets.push(lineHeight / 2);
widestLabelSize = Math.max(width, widestLabelSize);
highestLabelSize = Math.max(height, highestLabelSize);
}
garbageCollect(caches, length);

const widest = widths.indexOf(Math.max.apply(null, widths));
const highest = heights.indexOf(Math.max.apply(null, heights));
const widest = widths.indexOf(widestLabelSize);
const highest = heights.indexOf(highestLabelSize);

function valueAt(idx) {
return {
Expand Down

0 comments on commit b2c3203

Please sign in to comment.