Error when providing axis tickformat, but dataset is empty
Personne n'a encore pris cette issue.
- Langage dominant
- JavaScript
- Étoiles
- 18.3k
- Forks
- 2k
- Merge moyen
- 2 j 12 h
- PR mergées (30 j)
- 28
Description
I could not find this anywhere in reported/open/closed problems, so here goes.
I'm dynamically fetching my dataset for plotly - and sometimes there is no data - a normal condition for my app.
When providing a timestamp-like xaxis tickformat, an error will occur when the dataset is empty.
Plotly.newPlot(this.chartTarget.id, {
data: [
{ name: "Spot", type: "scatter", mode: 'lines', x: [], y: [], line: {color: 'black'} },
],
layout: {
title: "Blah",
hovermode: "closest",
hoverlabel: { bgcolor: "#FFF" },
legend: { orientation: 'h', y: -0.3 },
xaxis: { tickformat: "%H:%M", title: {text: "Time", automargin: true, standoff: 0}, zeroline: false },
yaxis: { title: "YAxis" }
},
config: { responsive: true }
});
When the dataset is empty alike above (and only when empty), a JS error will be thrown with a trace that looks like:
console.trace() WARN: encountered bad format: "%H:%M" plotly-finance.js:27425:18
warn plotly-finance.js:27425
warnBadFormat plotly-finance.js:25902
numberFormat plotly-finance.js:50110
numFormat plotly-finance.js:40235
formatLinear plotly-finance.js:40138
tickText plotly-finance.js:39918
setTickLabel plotly-finance.js:39477
calcTicks plotly-finance.js:39509
drawOne plotly-finance.js:40613
draw plotly-finance.js:40541
syncOrAsync plotly-finance.js:26272
draw plotly-finance.js:40534
drawAxes plotly-finance.js:31315
syncOrAsync plotly-finance.js:26272
_doPlot plotly-finance.js:31340
newPlot plotly-finance.js:31501
It seems like the format handler should be able to detect this situation and avoid the error when there's actually nothing to format in the first place.
Thanks for consideration and hopeful for a resolution within plotly itself for this potentially-expected condition.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Reproduisez l’appel Plotly.newPlot fourni avec des tableaux x et y vides et xaxis tickformat "%H:%M". Commencez par l’appel newPlot et les entrées de pile liées au format dans plotly-finance.js, puis confirmez qu’un jeu de données vide ne produit plus l’erreur bad-format.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- javascript
- Domaine
- data-visualization
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100