partial autorange gets overridden on subsequent `react` calls
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- JavaScript
- Star
- 18.3k
- Fork
- 2k
- Merge trung bình
- 2 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 28
Mô tả
I'm encountering some unexpected behavior pertaining to the partial autorange changes added in v2.26, which lets users use autorange behavior for one axis bound, but use a hard bound for the other.
After spending time on a minimal reproduction, distilled the core problem to autorange and range properties on layout.yaxis being overridden on subsequent calls to Plotly.react. For added context, I'm using react-plotly, which seems to exacerbate the problem (because Plotly relies on mutating the props supplied), but I'll remove React from the equation int his report and just focus on the raw Plotly behavior.
See the codepen here:
https://codepen.io/billy-littlefield/pen/JjqyXgW
In this example, I have a simple bar graph where the largest bar has value 4. In my layout, I set
autorange: "min"range: [null, 50]
with the intention of forcing the top bound to be 50.
The "rerender" button in the top-left will call Plotly.react with the same arguments as the initial call. You can reset the demo using a button in the top right.
My expectation is that subsequent clicks to "rerender" would result in an identical graph. The observed behavior is that on initial render, the graph I see shows the expected partial autorange, but a subsequent render changes autorange to true and range to the calculated autorange. I can double click the graph to return to the initial layout settings, but I'm surprised that it changes on me in the first place.
If this is working as expected, please disregard. I understand that Plotly mutates layout (and potentially data) in the computation cycle, but figured these mutations would not override the original expressed intention of a graph layout. Seeing as the partial autorange behavior is relatively new, I wondered if this might be unexpected behavior.
Hướng dẫn đóng góp
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.
Hướng nghiên cứu
Bắt đầu với CodePen được liên kết và các lệnh gọi Plotly.react thô, tập trung vào cách layout.yaxis autorange và range được xử lý qua các lần render lặp lại. Truy vết đường dẫn cập nhật làm thay đổi các thiết lập autorange một phần, sau đó xác minh rằng các lệnh gọi lặp lại vẫn giữ autorange: "min" và range: [null, 50] và tạo ra một biểu đồ giống hệt.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript
- Lĩnh vực
- data-visualization
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100