plotly / plotly/plotly.py

Expose private attribute _config in Figure/FigureWidget class as public property

Offen
#4,327 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

feature P3
Vorherrschende Sprache
Python
Sterne
18.8k
Forks
2.8k
Ø Merge
16 Std. 26 Min.
Gemergte PRs (30 T.)
21

Beschreibung

Hello Dev!

I have been using Plotly's Python library and encountered an issue when trying to set the figure config while preserving on_change callbacks on the same figure object.

The root cause is that _config is currently a private attribute in the BaseFigure class, and the only api way to modify it is through the fig.show(config=config) method call. However, show() rerenders the figure and won't carry existing on_change listeners.

Therefore, in theory, using __setattr__ to modify the _config attribute directly instead of using .show(config=config) would make both setting on_change() and setting config (e.g. scrollZoom = True) work well at the same fig, and this has been proven to be the case in testing.

So I suggest to make _config a public attribute that users can directly set it without calling show() or using setattr.

Many thanks for your supper awesome work on Plotly!

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

Lies packages/python/plotly/plotly/basedatatypes.py und verfolge BaseFigure._config, fig.show(config=...) und on_change-Callbacks. Ermittle, wie ein öffentlicher Konfigurations-Setter funktionieren sollte, ohne bestehende Callbacks zu verlieren; fertig ist die Aufgabe, wenn die Konfiguration von Figure und FigureWidget geändert werden kann, während die Callbacks weiterhin angehängt bleiben.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
data-visualization
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

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