ranges does not get computed when same data is used but Plot is updated
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 48/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- javascript, plotly, react
- Bereich
- data-visualization, frontend
Rechercherichtung
Beginne mit der verknüpften same_data-Reproduktion und verfolge den Aktualisierungspfad der Plot-Komponente, wenn sich das Layout ändert, die Daten aber wiederverwendet werden. Vergleiche die Varianten new_array und new_object, um das gemeinsame Verhalten zu ermitteln. Als abgeschlossen gilt die Änderung, wenn die ranges weiterhin berechnet werden und das Zoomen nach dem Klicken auf Update Plot weiterhin funktioniert.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
If layout is change but data stays the same, Plot's ranges are not computed correctly.
Consider this React component
(full project can be found here: https://github.com/saad-learns/react-plotly/tree/same_data
function App() {
const [plotUpdated, setPlotUpdated] = React.useState<number>(0);
const [plotParams, setPlotParams] = React.useState<PlotParams>({
data: [
{
x: [-3, -2, -1, 0, 1, 2, 3],
y: [
-0.1411200080598672, -0.9092974268256817, -0.8414709848078965, 0,
0.8414709848078965, 0.9092974268256817, 0.1411200080598672,
],
},
],
layout: {},
});
const updatePlot = () => {
setPlotParams((prevState) => ({
data: prevState.data,
layout: {},
}));
};
return (
<div className="App">
<div style={{ padding: 10 }}>
<button onClick={updatePlot}>Update Plot</button>
</div>
<Plot
data={plotParams.data}
layout={plotParams.layout}
onUpdate={() => setPlotUpdated((prevState) => prevState + 1)}
/>
<div>Plot updated: {plotUpdated}</div>
</div>
);
At the start, ranges are calculated correctly. You can verify that with React Dev Tool's Component tab:
Or you can use Zoom In and Zoom Out button to verify that zooming is working.
But if you click on the Update Plot button, the ranges are not computed, in fact they get removed:
Thereafter, zooming does not work.
Here, updatePlot will use the same data object, but makes use of a new layout. According to https://github.com/plotly/react-plotly.js#refreshing-the-plot Plot should be refreshed, and it does, but ranges are no longer computed correctly.
There are other variation of the above issue:
- Use a new array but same previous data element: https://github.com/saad-learns/react-plotly/blob/new_array/src/App.tsx
- Use a new array, and a new element but with same previous data: https://github.com/saad-learns/react-plotly/blob/new_object/src/App.tsx
where ranges are not computed properly.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 1.1k
- Forks
- 138
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus plotly/react-plotly.js
-
P3 plotly-internal size: 1 task
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 45/100
plotly/react-plotly.js#386 ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
plotly/react-plotly.js#358 · 1 Kommentar ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
plotly/react-plotly.js#354 ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 30/100
plotly/react-plotly.js#353 · 1 Kommentar ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
plotly/react-plotly.js#352 · 1 Kommentar ·
Alle Issues in plotly/react-plotly.js
Ähnliche Issues
-
bug confirmed js v6
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
BUG
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 90/100
linuxmint/cinnamon-spices-applets#9223 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
nopSolutions/nopCommerce#8440 ·
Maintainer antworten meist innerhalb von 1 Tag
-
follow-up
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
Maintainer antworten meist innerhalb von 1 Tag