Margins not updating correctly in pie chart after manual resizing
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, react
- Lĩnh vực
- data-visualization, frontend
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện vấn đề trong một ứng dụng React với plotly.js 3.0.x và react-plotly.js 2.6.0, sử dụng biểu đồ tròn với các phần [39,61]. Theo dõi quá trình cập nhật layout sau khi thay đổi chiều rộng từ 40 thành 400 và so sánh với trường hợp [10,90]. Hoàn thành có nghĩa là việc thay đổi kích thước và cập nhật margin sẽ tính toán lại không gian khả dụng cho biểu đồ tròn mà không yêu cầu thay đổi font-size.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- JavaScript
- Star
- 1.1k
- Fork
- 138
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của plotly/react-plotly.js
-
P3 plotly-internal size: 1 task
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
plotly/react-plotly.js#386 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
plotly/react-plotly.js#358 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 30/100
plotly/react-plotly.js#353 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
plotly/react-plotly.js#352 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
plotly/react-plotly.js#351 ·
Tất cả issue của plotly/react-plotly.js
Issue tương tự
-
[vika] console keeps a stale "in progress" turn after a daemon restart mid-runCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
volcengine/OpenViking#7011 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Issue: ready for confirmation Reported on 2.4.9 Triage: Dev.Experience
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
magento/magento2#41773 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Upgrade listener stays on a custom server after close when `preClose` is setCó thể đã có người làm @RaphaelFakhri đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
fastify/fastify-websocket#388 ·
-
[推荐] 影夕视频Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
-
Perl - Readme DriftCó thể đã có người làm @Omnideth đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
CommunityToolkit/Aspire#2375 ·
Maintainer thường phản hồi trong vòng 2 ngày