Multiple legends in horizontal mode overlap chart on resize from a narrow viewport to a wide one
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 18.3k
- フォーク
- 2k
- 平均マージ
- 2日 12時間
- マージ済み PR(30日)
- 28
説明
I am having troubles when changing from portrait mode to landscape mode as the legends overlap the x axis ticks or the chart itself.
Here is the reproducible example: https://codepen.io/bleah1/full/ZEMGVpY
Please use Inspect tools and either make the viewport narrow and then pull pretty fast to make it wide again or just go to mobile view and switch from portrait to landscape.
The legends remain in the same place when resizing from a narrow viewport to a wider one.
This behavior is not as bad on PC, because you can resize again and everything falls into place, but on mobile you can't resize the viewport/window, you can only refresh and I can't use it as it is now.
The code is pretty basic:
const plotDiv = document.getElementById('plot');
const traces = [
{x: [1,2,3], y: [2,1,4], stackgroup: 'one'},
{x: [1,2,3], y: [1,1,2], stackgroup: 'one'},
{x: [1,2,3], y: [3,0,2], stackgroup: 'one'},
{x: [1,2,3], y: [4,3,2], stackgroup: 'one'},
{x: [1,2,3], y: [5,5,2], stackgroup: 'one'},
];
const layout = {
showlegend: true,
legend: {
x: 0,
// y: 1,
orientation: "h",
traceorder: "normal",
yanchor: "top",
},
autosize: true,
margin: { pad: 10, b: 10, l: 40, r: 40, t: 80 },
}
const config = {
responsive: true
}
Plotly.newPlot('myDiv', traces, layout, config);
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされた CodePen の再現を起点に、plotly.js における凡例の水平方向の配置に関するレスポンシブなリサイズ経路を調査します。狭い状態から広い状態へのリサイズとリフレッシュを比較し、その後、viewport の変更後に凡例が x 軸の目盛りやチャートと重ならなくなっていることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100