plotly.js
plotly.js copied to clipboard
`autorange` throws when y range is small
When max(y) - min(y) is a very small value, ie, Number.MIN_VALUE, plotly failed to draw the plot.
Codepen https://codepen.io/opportunityliu/pen/QWmwPEO
TESTER = document.getElementById('tester');
Plotly.react( TESTER, [{
x: [1, 2, 3, 4, 5],
y: [0,0,0,0,Number.MIN_VALUE] }]);

Got error:
plotly-2.12.1.js:141901
Uncaught TypeError: Cannot read properties of undefined (reading 'val')
at getAutoRange (plotly-2.12.1.js:141901:26)
at doAutoRange (plotly-2.12.1.js:142098:56)
at exports.doAutoRangeAndConstraints (plotly-2.12.1.js:140196:13)
at doAutoRangeAndConstraints (plotly-2.12.1.js:134769:21)
at lib.syncOrAsync (plotly-2.12.1.js:129221:15)
at positionAndAutorange (plotly-2.12.1.js:134759:20)
at lib.syncOrAsync (plotly-2.12.1.js:129221:15)
at Object._doPlot (plotly-2.12.1.js:134834:24)
at Object.newPlot (plotly-2.12.1.js:135011:20)
at Object.react (plotly-2.12.1.js:137070:28)
When the diff become slightly larger, ie, 1e-310, I got another error and an empty plot
Codepen https://codepen.io/opportunityliu/pen/wvmBZEy
TESTER = document.getElementById('tester');
Plotly.react( TESTER, [{
x: [1, 2, 3, 4, 5],
y: [0,0,0,0,1e-310] }]);

plotly-2.12.1.js:153093
Uncaught Error: Something went wrong with axis scaling
at ax.setScale (plotly-2.12.1.js:153093:19)
at axes.drawOne (plotly-2.12.1.js:144647:8)
at plotly-2.12.1.js:144605:31
at lib.syncOrAsync (plotly-2.12.1.js:129221:15)
at axes.draw (plotly-2.12.1.js:144600:16)
at drawAxes (plotly-2.12.1.js:134783:21)
at lib.syncOrAsync (plotly-2.12.1.js:129221:15)
at Object._doPlot (plotly-2.12.1.js:134834:24)
at Object.newPlot (plotly-2.12.1.js:135011:20)
at Object.react (plotly-2.12.1.js:137070:28)