X-axis type lost after restyle
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 45/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- javascript
研究方向
先執行使用 Plotly.newPlot 和 Plotly.restyle 的自包含 HTML 範例,然後追蹤更新長條圖的 restyle 路徑。完成的標準是:替換 y 值後,x 軸仍維持類別型,而不是被重新推斷為線性型。
由索引模型根據 Issue 內容生成。
描述
If i create a bar chart with a categorical x-axis, where the x-values are strings of digits, then restyle it with new y-values, the categoricality of the x-axis is lost, and it becomes linear, as if the type had been freshly inferred from the values.
Here is a self-contained example (i'm afraid i don't have a codepen account):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Restyle</title>
<script src="https://cdn.plot.ly/plotly-latest.js"></script>
<script>
addEventListener("DOMContentLoaded", () => {
const plot = document.getElementById("plot");
Plotly.newPlot(plot,
{
data: [{
type: "bar",
x: ["2", "5", "10", "30", "50"],
y: [1, 2, 3, 4, 5]
}],
layout: {
xaxis: {type: "category"}
},
config: {
responsive: true
}
});
document.getElementById("restyle").addEventListener("click", () => {
Plotly.restyle(plot, {y: [[5, 4, 3, 2, 1]]}, 0);
});
});
</script>
</head>
<body>
<div id="plot"></div>
<button id="restyle">Restyle</button>
</body>
</html>
When the page loads, the x-axis is correctly categorical, but when you click the button, it becomes incorrectly linear.
I believe this is the same problem as described in the forum post "X-axis “category” type not honored after Plotly.restyle".
- 主要語言
- JavaScript
- 星號
- 18.4k
- 分支
- 2k
- 平均合併
- 2 天 7 小時
- 30 天內合併 PR
- 18
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
plotly/plotly.js 的其他 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 86/100
維護者通常 1 天內回覆
-
[BUG]: `hoverlabel.align` is ignored in `hovermode: "x unified"`可能已有人在做 @MannXo 於 1 天前認領。 未關閉bug good first issue P2 size: 1
難度 2/5 1-3 小時 新手友好度 78/100
plotly/plotly.js#8100 · 3 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
chore P3 plotly-internal size: 3 task
難度 2/5 1-3 小時 新手友好度 77/100
plotly/plotly.js#8064 · 1 則留言 ·
維護者通常 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 天內回覆
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 82/100
invoiceninja/invoiceninja#13320 ·
維護者通常 1 天內回覆
-
NoCode.vue, Task.vue: replace explicit `any` with real types可能已有人在做 @prayas-bit 今天認領。 未關閉area/frontend good first issue kind/cooldown
難度 2/5 1-3 小時 新手友好度 67/100
kestra-io/kestra#20347 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 70/100
ubuntu/gnome-shell-extension-appindicator#676 · 1 則留言 ·