plotly / plotly/plotly.js

disable default selection of button in range selector buttons

Aperta
#4,709 6 commenti 13 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

Hello all,

Right now, enabling the use of buttons in layout.xaxis.rangeselector makes it such that the button 'all' is always selected by default, no matter where it is positioned in the list of buttons. If the button 'all' is not present, the display is still rendered as if it was selected by default.

May we add a default (boolean) property inside a button to know which should be selected by default when first displaying the graph ? This could help to focus on a key point of the data, while allowing the user to zoom out by clicking the 'all' button or by double-clicking on the graph.
This property would be set to false by default, and if no buttons show a true value for this property, then the usual 'all' display shall be rendered.

Example :
Usual display

var layout = {
xaxis: {
            autorange: true,
            rangeselector: {
                buttons: [
                    {
                        count: 1,
                        label: '1m',
                        step: 'month',
                        stepmode: 'backward'
                    },
                    {
                        count: 6,
                        label: '6m',
                        step: 'month',
                        stepmode: 'backward'
                    },
                    {   
                        step: 'all'
                    }
                ]
            },
            rangeslider: {autorange: true},
            type: 'date'
        }
};

In the second case, when loading the page, we already have the 6 months zoom.
6 months button selected by default

var layout = {
        xaxis: {
            autorange: true,
            rangeselector: {
                buttons: [
                    {
                        count: 1,
                        label: '1m',
                        step: 'month',
                        stepmode: 'backward'
                    },
                    {
                        count: 6,
                        label: '6m',
                        step: 'month',
                        stepmode: 'backward',
                        default: true
                    },
                    {   
                        step: 'all'
                    }
                ]
            },
            rangeslider: {autorange: true},
            type: 'date'
        }
};

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 dalla gestione dei pulsanti xaxis.rangeselector descritta nell’issue e traccia il modo in cui viene scelto l’intervallo selezionato inizialmente. Il lavoro è completato quando un pulsante con default: true controlla l’intervallo iniziale, mentre il comportamento esistente di “all” rimane il fallback quando nessun pulsante è contrassegnato come predefinito.

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

Valutazione

Stack tecnologico
javascript
Ambito
data-visualization
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
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.