Error when providing axis tickformat, but dataset is empty
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 45/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- javascript
研究方向
重現提供的 Plotly.newPlot 呼叫,使用空的 x 和 y 陣列以及 xaxis tickformat "%H:%M"。從 newPlot 呼叫和 plotly-finance.js 中與格式相關的堆疊項目開始,然後確認空資料集不再產生 bad-format 錯誤。
由索引模型根據 Issue 內容生成。
描述
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.
- 主要語言
- JavaScript
- 星號
- 18.3k
- 分支
- 2k
- 平均合併
- 1 天 19 小時
- 30 天內合併 PR
- 21
環境準備
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
plotly/plotly.js 的其他 Issue
-
bug
難度 1/5 1 小時以內 新手友好度 85/100
維護者通常 1 天內回覆
-
chore P3 plotly-internal size: 3 task
難度 2/5 1-3 小時 新手友好度 77/100
維護者通常 1 天內回覆
-
chore P1 plotly-internal size: 1 task
難度 1/5 1 小時以內 新手友好度 82/100
維護者通常 1 天內回覆
-
chore P3 plotly-internal size: 1 task
難度 2/5 1-3 小時 新手友好度 65/100
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 65/100
plotly/plotly.js#7648 · 3 則留言 ·
維護者通常 1 天內回覆
相似的 Issue
-
status: waiting triage
難度 2/5 1-3 小時 新手友好度 84/100
freeCodeCamp/freeCodeCamp#70412 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 84/100
Jason-Vaughan/TangleClaw#1884 ·
維護者通常 1 天內回覆
-
bug good first issue web
難度 2/5 1-3 小時 新手友好度 85/100
-
難度 2/5 1-3 小時 新手友好度 84/100
microsoft/TypeScript#64453 ·
維護者通常 1 天內回覆
-
self-driving
難度 2/5 1-3 小時 新手友好度 74/100
維護者通常 1 天內回覆