[BUG]: `sankey`: `node.x` / `node.y` of `0` is ignored
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- d3, javascript
- Domain
- data-visualization, frontend
Research direction
Start in src/traces/sankey/render.js at the “Force node position” loop and check how it tests trace.node.x[p] and trace.node.y[p] for missing values. Reproduce with the supplied Plotly.newPlot example using arrangement: 'fixed'. Done when coordinates of 0 are respected and the sankey_x_y_with_arrows.json mock baseline is updated as needed.
Written by the indexing model from the issue text.
Description
Description
Node coordinates of 0 for node.x or node.yare ignored and the node gets positioned automatically.
Screenshots
With 0 coords:
With close to 0 coords:
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
ais 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.jsuses a truthy test (if(trace.node.x[p] && trace.node.y[p])), and0is falsy - The fix is to change the test for missing values to
!= null - The mock
sankey_x_y_with_arrows.jsonsetsy: [0, 0, 0], so the fix changes its baseline - Discovered while working on #7826
- Dominant language
- JavaScript
- Stars
- 18.4k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 12
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from plotly/plotly.js
-
bug P3 size: 1
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 2 days
-
bug P3 size: 3
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
plotly/plotly.js#8108 · 4 comments ·
Maintainers usually reply within 2 days
-
chore P3 plotly-internal size: 3 task
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
plotly/plotly.js#8064 · 1 comment ·
Maintainers usually reply within 2 days
-
chore P1 plotly-internal size: 1 task
Difficulty 1/5 Under an hour Newbie friendliness 82/100
Maintainers usually reply within 2 days
-
chore P3 plotly-internal size: 1 task
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 2 days
All issues in plotly/plotly.js
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Aethelgard-Systems/agent-postbox#32 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
SamuelNDCE/plume#42 ·
Maintainers usually reply within 1 day
-
[UI] Theme Provider Props table overflows on mobile viewportsPossibly taken @SajanBisht claimed this today. Openframework/gatsby help wanted kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
layer5io/layer5#8264 · 1 comment ·
Maintainers usually reply within 3 days