plotly / plotly/plotly.js

[FEATURE]: Better error message for axis scaling.

Aperta
#7,568 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

feature
Lingua principale
JavaScript
Stelle
18.3k
Fork
2k
Merge medio
2g 12h
PR unite (30g)
28

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Parti dal punto di ingresso Plotly.newPlot e segui l’errore esistente di ridimensionamento degli assi descritto nell’issue. Determina dove sono disponibili le dimensioni del contenitore e come viene prodotto l’errore attuale; il lavoro è completato quando l’errore segnala che il contenitore è troppo piccolo per eseguire il rendering del grafico e guida gli sviluppatori a correggerne le dimensioni.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript
Ambito
data-visualization
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.