plotly / plotly/plotly.js

[FEATURE]: Better error message for axis scaling.

Open
#7,568 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
JavaScript
Stars
18.3k
Forks
2k
Avg merge
2d 12h
Merged PRs (30d)
28

Description

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?
  1. 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.
  2. 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.
  3. 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.newPlot that 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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Plotly.newPlot entry point and trace the existing axis-scaling error described in the issue. Determine where container dimensions are available and how the current error is produced; done means the failure reports that the container is too small to render the chart and guides developers toward fixing its dimensions.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.