X-axis type lost after restyle
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 18.3k
- フォーク
- 2k
- 平均マージ
- 2日 12時間
- マージ済み PR(30日)
- 28
説明
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".
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず Plotly.newPlot と Plotly.restyle を使った自己完結型の HTML 例を実行し、次に棒グラフを更新する restyle パスを追跡します。y 値を置き換えた後も x 軸がカテゴリのまま維持され、線形として再推論されなければ完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100