plotly / plotly/plotly.js

enable tonexty without fallback to tozeroy

Aperta
#5,538 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

feature P3
Lingua principale
JavaScript
Stelle
18.3k
Fork
2k
Merge medio
2g 12h
PR unite (30g)
28

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo l'esempio di quantile-trace descritto nell'issue e analizza il comportamento di fill_type=tonexty quando la trace precedente è nascosta. Esamina il comportamento di fill esistente in Plotly.js e determina come dovrebbe essere rappresentato un fallback senza riempimento; il lavoro è completato quando il caso della trace nascosta preserva l'area tra i limiti rimanenti senza ricorrere a tozeroy.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript
Ambito
data-visualization
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.