partial autorange gets overridden on subsequent `react` calls
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- JavaScript
- Estrellas
- 18.3k
- Forks
- 2k
- Merge medio
- 2 d 12 h
- PR fusionados (30 d)
- 28
Descripción
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.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con el CodePen enlazado y las llamadas sin procesar a Plotly.react, centrándote en cómo se gestionan layout.yaxis autorange y range en renderizados repetidos. Sigue la ruta de actualización que cambia la configuración parcial de autorange y, a continuación, verifica que las llamadas repetidas conservan autorange: "min" y range: [null, 50] y producen un gráfico idéntico.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript
- Área
- data-visualization
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100