Error when providing axis tickformat, but dataset is empty
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 18.3k
- フォーク
- 2k
- 平均マージ
- 2日 12時間
- マージ済み PR(30日)
- 28
説明
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.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
空の x 配列と y 配列、および xaxis tickformat "%H:%M" を指定した、提供された Plotly.newPlot 呼び出しを再現します。newPlot 呼び出しと plotly-finance.js 内のフォーマット関連のスタックエントリから始め、その後、空のデータセットで bad-format エラーが発生しなくなったことを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100