[FEATURE]: Better error message for axis scaling.
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ả
Description
Currently, when a Plotly chart is rendered inside a container <div> that is too small (e.g., height = 0 or very small), Plotly.js throws a very broad error:
Uncaught (in promise) Error: Something went wrong with axis scaling
The error stack traces to internal scaling functions, but it provides no actionable guidance for the developer. In my case, the issue was resolved by explicitly setting a minimum height on the container:
#plotlyContainer {
min-height: 600px;
}
The error message should instead clearly indicate that the container element is too small to render the chart, so developers can quickly diagnose the problem.
Why should this feature be added?
- Improved developer experience: The current error is misleading and vague. Many users may spend significant time debugging chart data or layout issues when the root cause is the container size.
- Faster debugging: A clear, descriptive error such as "Plotly container height is too small to render the chart" would allow developers to quickly fix layout issues.
- Prevents unnecessary workarounds: Developers currently have to discover these issues through trial and error.
Mocks/Designs
No visual mockups required. The requested change is purely to improve the clarity of the error message.
Notes
- This could potentially be implemented as a validation step during
Plotly.newPlotthat checks the container's computed height and width before rendering. - It might also be helpful to provide a warning in the console if either dimension is below a certain threshold.
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 từ điểm vào Plotly.newPlot và lần theo lỗi co giãn trục hiện có được mô tả trong issue. Xác định nơi có các kích thước của container và cách lỗi hiện tại được tạo ra; công việc được xem là hoàn tất khi lỗi thông báo rằng container quá nhỏ để render biểu đồ và hướng dẫn các nhà phát triển sửa kích thước của nó.
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
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 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
- 35/100