plotly / plotly/plotly.js

strange jumps when zooming on real time chart

Offen
#7,438 5 Kommentare 3 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

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

Beschreibung

Hi,

is there a way to fix this?
not sure if it's related to react-plotly or plotly.js
The chart jumps back and forth in a confusing way while scrolling forward.
The faster I scroll the more extreme it jumps back.
When using the toolbar, it behaves normal.

https://user-images.githubusercontent.com/45887282/110695326-a32a1180-81e1-11eb-8481-6e54cc9a2719.mp4


    useEffect(() => {

        setInterval(()=>{

            $_state(($:any) => {

                console.log($)

                const _x = $.data[0].x
                const _y = $.data[0].y

                const _ymin = _y[_y.length-1] - gaussianRand()/100
                const _ypls = _y[_y.length-1] + gaussianRand()/100

                return {...$, data: [
                    {
                        ...$.data[0],
                        x: [..._x, _x[_x.length-1]+0.1],
                        y: [..._y, ~~(Math.random()*2) ? _ymin : _ypls],
                    }
                ]}

            })

        }, 100)
        
    },[])


    return (
        <Plot 
            className={jss.root} 
            data={_state.data}
            layout={_state.layout}
            config={_state.config}
            onInitialized={figure => $_state(figure)}
            onUpdate={figure => $_state(figure)}
        />
      );

    const [_state, $_state] = useState({
        data:[
        {
            type: 'scattergl',
            mode: 'markers',
            marker: {
                color : 'rgba(255, 255, 255, 0)',
                line: {
                    width: 1,
                    color: ['rgba(255, 255, 255, 0.5)', 'rgba(255, 255, 0, 1)']
                }
            },
            x: [0],
            y: [0],
        }]
    , layout: {
        title: '-',

        font: {
            family:'IBM Plex Mono',
            size:10,
        },
        margin: {
            l: 50,
            r: 50,
            b: 50,
            t: 50,
            pad: 4
          },
        plot_bgcolor: 'rgba(255,255,255,0)',
        paper_bgcolor: 'rgba(255,255,255,0)',
        yaxis: {
            tickcolor: 'rgba(255,255,255,0.1)',
            tickwidth: 1,
            
            gridcolor: 'rgba(255,255,255,0.1)',
            gridwidth: 1,
            
            zerolinecolor: 'rgba(255,255,255,0.1)',
            zerolinewidth: 1,
          },
          xaxis: {
            tickcolor: 'rgba(255,255,255,0.1)',
            tickwidth: 1,

            zerolinecolor: 'rgba(255,255,255,0.1)',
            zerolinewidth: 1,

            gridcolor: 'rgba(255,255,255,0.1)',
            gridwidth: 1,
          
          },
    }, frames: [], config: {
        scrollZoom:true,
        
    }})

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 mit dem bereitgestellten React-Beispiel, das den scattergl-Chart von Plotly, schnell angehängte x/y-Daten und aktiviertes scrollZoom verwendet. Vergleiche das Scrollen per Mausrad mit dem Verhalten der Toolbar und verwende die verlinkte Aufzeichnung, um die Rücksprünge zu reproduzieren; abgeschlossen ist die Aufgabe, wenn das Vorwärtsscrollen stabil bleibt, während Echtzeitdaten angehängt werden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, react
Bereich
data-visualization, frontend
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Aktiv
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

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