partial autorange gets overridden on subsequent `react` calls
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 18.3k
- Fork
- 2k
- Merge medio
- 2g 12h
- PR unite (30g)
- 28
Descrizione
I'm encountering some unexpected behavior pertaining to the partial autorange changes added in v2.26, which lets users use autorange behavior for one axis bound, but use a hard bound for the other.
After spending time on a minimal reproduction, distilled the core problem to autorange and range properties on layout.yaxis being overridden on subsequent calls to Plotly.react. For added context, I'm using react-plotly, which seems to exacerbate the problem (because Plotly relies on mutating the props supplied), but I'll remove React from the equation int his report and just focus on the raw Plotly behavior.
See the codepen here:
https://codepen.io/billy-littlefield/pen/JjqyXgW
In this example, I have a simple bar graph where the largest bar has value 4. In my layout, I set
autorange: "min"range: [null, 50]
with the intention of forcing the top bound to be 50.
The "rerender" button in the top-left will call Plotly.react with the same arguments as the initial call. You can reset the demo using a button in the top right.
My expectation is that subsequent clicks to "rerender" would result in an identical graph. The observed behavior is that on initial render, the graph I see shows the expected partial autorange, but a subsequent render changes autorange to true and range to the calculated autorange. I can double click the graph to return to the initial layout settings, but I'm surprised that it changes on me in the first place.
If this is working as expected, please disregard. I understand that Plotly mutates layout (and potentially data) in the computation cycle, but figured these mutations would not override the original expressed intention of a graph layout. Seeing as the partial autorange behavior is relatively new, I wondered if this might be unexpected behavior.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con il CodePen collegato e le chiamate grezze a Plotly.react, concentrandoti su come vengono gestiti layout.yaxis autorange e range durante rendering ripetuti. Segui il percorso di aggiornamento che modifica le impostazioni parziali di autorange, quindi verifica che chiamate ripetute mantengano autorange: "min" e range: [null, 50] e producano un grafico identico.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript
- Ambito
- data-visualization
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100