plotly / plotly/plotly.js

partial autorange gets overridden on subsequent `react` calls

Ouverte
#7,024 1 commentaire 3 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

bug P3
Langage dominant
JavaScript
Étoiles
18.3k
Forks
2k
Merge moyen
2 j 12 h
PR mergées (30 j)
28

Description

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.

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par le CodePen lié et les appels bruts à Plotly.react, en vous concentrant sur la manière dont layout.yaxis autorange et range sont gérés lors de rendus répétés. Suivez le chemin de mise à jour qui modifie les paramètres partiels d’autorange, puis vérifiez que des appels répétés préservent autorange: "min" et range: [null, 50] et produisent un graphique identique.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
javascript
Domaine
data-visualization
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.