Margins not updating correctly in pie chart after manual resizing
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- javascript, react
- Bereich
- data-visualization, frontend
Rechercherichtung
Beginne damit, das Problem in einer React-App mit plotly.js 3.0.x und react-plotly.js 2.6.0 zu reproduzieren, indem du ein Kreisdiagramm mit den Segmenten [39,61] verwendest. Verfolge das Layout-Update nach der Änderung der Breite von 40 auf 400 und vergleiche es mit dem Fall [10,90]. Als erledigt gilt die Aufgabe, wenn Größenänderungen und Aktualisierungen des Randes den verfügbaren Platz für das Kreisdiagramm neu berechnen, ohne eine Änderung der font-size zu erfordern.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
When dynamically updating a pie chart, I encountered an issue where the available space for the pie chart does not update properly after changing the plot size.
For my setup, the plot is rendered using Plotly in a React app. The plot state is managed using useState() and the layout updates are triggered via useEffect() whenever a user changes the settings object (for plot width, height, font, etc). The update is performed like this:
setPlot((prevPlot) => ({
...prevPlot,
layout: {
...prevPlot.layout,
width: displaySizes.width,
height: displaySizes.height,
margin: {
...prevPlot.layout.margin,
t: settings.marginTop,
b: settings.marginBottom,
l: settings.marginLeft,
r: settings.marginRight,
},
// other layout updates
},
}));
Used versions are "plotly.js": "^3.0.0", "plotly.js-dist-min": "^3.0.1", "react-plotly.js": "^2.6.0".
Steps to reproduce the described bug:
- Render a pie chart with segments [39,61]
- Set the plot size to an incorrect size, e.g. width: 40, height: 255
- Correct the plot size to valid values, e.g. width: 400, height: 255
Plot, before resizing:
Plot, after resizing as described:
The visible margins are now way larger than what is defined in the layout and much larger than necessary, since the pie chart could take up more space (like before). Changing the margins or plot size has no effect on the margins; only randomly increasing or decreasing the text size causes the plot to reset and render correctly.
It seems like the issue is related to the segment ratio: It only occurs when the pie segments are similar (e.g. [39, 61]), but not when they differ a lot (e.g. [10, 90]).
None of the approaches I came across online (such as Plotly.Plots.resize() or using the revision prop) solved this problem.
- 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 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 ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 25/100
plotly/react-plotly.js#351 ·
Alle Issues in plotly/react-plotly.js
Ähnliche Issues
-
good first issue help wanted
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
modrollstudio/Modroll-Studio-Website#80 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
good first issue help wanted
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 82/100
-
area: panel enhancement
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 72/100
GabrielGirardi/ledge#7 ·
-
0. Needs triage 35-feedback bug
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 62/100
Maintainer antworten meist innerhalb von 1 Tag
-
A-linter
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 73/100
oxc-project/oxc#28783 ·
Maintainer antworten meist innerhalb von 1 Tag