plotly / plotly/plotly.js

enable tonexty without fallback to tozeroy

Offen
#5,538 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

feature P3
Vorherrschende Sprache
JavaScript
Sterne
18.3k
Forks
2k
Ø Merge
2 T. 12 Std.
Gemergte PRs (30 T.)
28

Beschreibung

In our use case, we are plotting quantiles of a data set, with lower and upper bound as well as the median. For convenience, we need to fill in the area between the upper and lower bound shown.

The way we have solved this is by setting fill_type=tonexty on all traces and fill_color=gray on the top four traces, but fill_color=None on the bottom trace.

It looks like this:

scatter all visible

The problem is if a user disables the bottom trace, the tonexty fill of the second-to-last trace falls back to tozeroy:

scatter one hidden

This makes no sense in our case. The expected/intended behavior is:

scatter one hidden expected

We have tried/considered several methods:

  1. Creating a stackgroup; this does allow a fill 'inside' the group only, but requires the trace values to be stacked, which they fundamentally aren't; hiding a trace in that case moves the traces above, which is incorrect.
  2. Disabling the trace toggle; this hides the problem of course, but it also disables a useful feature
  3. Dynamically changing the fill_colors when a trace is hidden; this might work, but I can't find an event to hook into, and since we are using Dash, doing this kind of hacking between Python and clientside callbacks is nontrivial at best.

The best solution would be a fill_type that fills to next but falls back to no fill.

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, das im Issue beschriebene Quantil-Trace-Beispiel zu reproduzieren, und untersuche, wie sich fill_type=tonexty verhält, wenn der vorhergehende Trace ausgeblendet ist. Überprüfe das bestehende Fill-Verhalten von Plotly.js und bestimme, wie ein Fallback ohne Füllung dargestellt werden sollte; als erledigt gilt die Aufgabe, wenn der Fall mit ausgeblendetem Trace den Bereich zwischen den verbleibenden Grenzen beibehält, ohne auf tozeroy zurückzufallen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript
Bereich
data-visualization
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
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.