[FEATURE]: Better error message for axis scaling.
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 18.3k
- 派生
- 2k
- 平均合并
- 2 天 12 小时
- 30 天内合并 PR
- 28
描述
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.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 Plotly.newPlot 入口点开始,跟踪 issue 中描述的现有坐标轴缩放错误。确定容器尺寸在哪里可用,以及当前错误是如何产生的;完成的标准是,失败信息报告容器太小而无法渲染图表,并引导开发者修复其尺寸。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- data-visualization
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100