Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[BUG]: `sankey`: `node.x` / `node.y` of `0` is ignored

オープン 初心者向け
#8,150 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
75/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
d3, javascript

調査の方向性

src/traces/sankey/render.js の「Force node position」ループから始め、trace.node.x[p] と trace.node.y[p] が欠損値かどうかをどのように判定しているか確認してください。arrangement: 'fixed' を指定した、提供されている Plotly.newPlot の例で再現してください。座標の 0 が尊重され、必要に応じてモックのベースライン sankey_x_y_with_arrows.json が更新されたら完了です。

索引モデルが issue の本文から書いたものです。

説明

bug P3 size: 1
Description

Node coordinates of 0 for node.x or node.yare ignored and the node gets positioned automatically.

Screenshots

With 0 coords:

Image

With close to 0 coords:

Image
Steps to reproduce
  • Open Plotly devtools and paste the following into browser devtools:
Plotly.newPlot('g', [{
  type: 'sankey',
  arrangement: 'fixed',
  node: {label: ['a', 'b', 'c'], x: [0, 0.5, 0.8], y: [0, 0, 0.7]},
  link: {source: [0, 1], target: [1, 2], value: [1, 1]}
}], {margin: {l: 0, r: 0, t: 0, b: 0}});
  • Note that the center of a is not in the top left corner of the plot
Notes
  • This issue stems from the fact that the "Force node position" loop in src/traces/sankey/render.js uses a truthy test (if(trace.node.x[p] && trace.node.y[p])), and 0 is falsy
  • The fix is to change the test for missing values to != null
  • The mock sankey_x_y_with_arrows.json sets y: [0, 0, 0], so the fix changes its baseline
  • Discovered while working on #7826
主要言語
JavaScript
スター
18.4k
フォーク
2.1k
平均マージ
1日 9時間
マージ済み PR(30日)
12

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

plotly/plotly.js のほかの issue

plotly/plotly.js の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。