plotly / plotly/plotly.js

[FEATURE]: Better error message for axis scaling.

オープン
#7,568 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

feature
主要言語
JavaScript
スター
18.3k
フォーク
2k
平均マージ
2日 12時間
マージ済み PR(30日)
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?
  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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Plotly.newPlot のエントリポイントから開始し、issue に記載されている既存の軸スケーリングエラーを追跡します。コンテナの寸法がどこで利用可能か、また現在のエラーがどのように生成されるかを特定します。完了条件は、コンテナが小さすぎてチャートをレンダリングできないことを失敗が報告し、開発者にその寸法を修正するよう案内することです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript
領域
data-visualization
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。