`autorange` throws when y range is small
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 18.3k
- Forks
- 2k
- Ø Merge
- 2 T. 12 Std.
- Gemergte PRs (30 T.)
- 28
Beschreibung
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)
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduziere den Fehler mit den beiden JavaScript-Beispielen und verfolge den gemeldeten Stack von getAutoRange und doAutoRange bis zu ax.setScale. Die Korrektur ist abgeschlossen, wenn beide sehr kleinen y-Bereiche erfolgreich gerendert werden, ohne Fehler aufgrund undefinierter Werte oder bei der Achsenskalierung.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript
- Bereich
- data-visualization
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100