plotly / plotly/plotly.js

[BUG]: `layout.uirevision` doesn't play well with map subplot auto-fit

Offen
#7,907 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug good for agent P2 plotly-internal size: 3
Vorherrschende Sprache
JavaScript
Sterne
18.3k
Forks
2k
Ø Merge
2 T. 12 Std.
Gemergte PRs (30 T.)
28

Beschreibung

Description

When a map subplot uses fitbounds, layout.uirevision fails to preserve the user's subsequent pan/zoom across Plotly.react calls. The map snaps back to the auto-fit view even when the uirevision value is unchanged.

Screenshots/Video

https://github.com/user-attachments/assets/48f4da34-d74f-4958-a874-2bd9a3844181

Steps to reproduce
  • Be on v4.0 (or the default branch after it gets released)
  • Plot a scattermap with uirevision set and no explicit center/zoom:
    Plotly.newPlot(gd, [{
      type: 'scattermap',
      lon: [-75, -74, -73],
      lat: [40, 41, 42],
      mode: 'markers'
    }], {
      uirevision: 'v1',
      width: 400,
      height: 400
    });
    
  • Pan the map with the mouse
  • Call Plotly.react with the same uirevision:
    Plotly.react(gd, gd.data, { uirevision: 'v1', width: 400, height: 400 });
    
  • Note that the map snaps back to the auto-fit view instead of keeping the panned view
Notes
  • Discovered while working on #7884. The auto-fit and zoom-button behaviors landed there; this uirevision integration was deferred as out-of-scope.
  • This works correctly for cartesian axes (via autorange) and for map subplots when the user has supplied an explicit center/zoom from the start. It only fails on the auto-fit path.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, den scattermap-Fall mit unverändertem layout.uirevision zu reproduzieren, und verfolge dann den Auto-Fit-Pfad des Karten-Subplots während Plotly.react. Vergleiche ihn mit dem bestehenden Verhalten für explizites center/zoom und dem Verhalten von autorange bei kartesischen Plots. Als erledigt gilt die Aufgabe, wenn das Panning oder Zoomen eines Benutzers über Plotly.react-Aufrufe hinweg erhalten bleibt, solange uirevision unverändert ist.

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
Aktiv
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
68/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.