You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem exists on line 7230 in envision.js in the extendYRange function.
As an example, two values of min and max are compared... let's use:
o min = 18.0001530072
o max = 18.0001530082
Let's use 2 for our line width and we get this:
o range = (max-min) //1.000000082740371e-9
o max += 2 * 0.01 //18.0201530082
o min -= 2*0.01 //17.980153007200002
o newRange = (min-max) //0.04000000099999923
o newRange / range //39999997.69038458
As shown above, 39999997.69038458 is the number of ticks that will be added to Y Axis. This causes the browser to freeze and crash.
Function in question:
extendYRange : function (axis, data, options, lines) {
//JMM: Added this because increasing the min/max when numbers with very little difference between min and max (e.g 1e-9) meant that the size of the adjustment above caused millions of ticks to be generated. So, we need to scale the tick size with the axis range.
if((axis.max - axis.min)/axis.tickSize > numTicks)
{
axis.tickSize = (axis.max-axis.min)/numTicks;
}
/*
axis.max = axis.p2d((axis.d2p(axis.max) + options.lineWidth));
axis.min = axis.p2d((axis.d2p(axis.max) - options.lineWidth));
*/
}
}
});
This is what I did to fix this, but am not sure if this is a good general solution since I am not sure why the range is being extended in the first place.
Thanks!
-Jacqui
The text was updated successfully, but these errors were encountered:
The problem exists on line 7230 in envision.js in the extendYRange function.
As an example, two values of min and max are compared... let's use:
o min = 18.0001530072
o max = 18.0001530082
Let's use 2 for our line width and we get this:
o range = (max-min) //1.000000082740371e-9
o max += 2 * 0.01 //18.0201530082
o min -= 2*0.01 //17.980153007200002
o newRange = (min-max) //0.04000000099999923
o newRange / range //39999997.69038458
As shown above, 39999997.69038458 is the number of ticks that will be added to Y Axis. This causes the browser to freeze and crash.
Function in question:
extendYRange : function (axis, data, options, lines) {
}
});
I have modified this in my code base to resolve the issue for myself. I am now scaling the tick size with the axis range:
// HACK
var numTicks = (axis.max-axis.min)/axis.tickSize;
if ((!o.max && o.max !== 0) || (!o.min && o.min !== 0)) {
axis.max += options.lineWidth * 0.01;
axis.min -= options.lineWidth * 0.01;
//JMM: Added this because increasing the min/max when numbers with very little difference between min and max (e.g 1e-9) meant that the size of the adjustment above caused millions of ticks to be generated. So, we need to scale the tick size with the axis range.
if((axis.max - axis.min)/axis.tickSize > numTicks)
{
axis.tickSize = (axis.max-axis.min)/numTicks;
}
/*
axis.max = axis.p2d((axis.d2p(axis.max) + options.lineWidth));
axis.min = axis.p2d((axis.d2p(axis.max) - options.lineWidth));
*/
}
}
});
This is what I did to fix this, but am not sure if this is a good general solution since I am not sure why the range is being extended in the first place.
Thanks!
-Jacqui
The text was updated successfully, but these errors were encountered: