plotly / plotly/plotly.js

[BUG]: Sankey warning breaks in @plotly/d3-sankey v0.12.3

Open
#7,832 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3 size: 1
Dominant language
JavaScript
Stars
18.3k
Forks
2k
Avg merge
2d 12h
Merged PRs (30d)
28

Description

Description

The upgrade to @plotly/d3-sankey v0.12.3 (in #7830) will break the warning here:

if (sankey.nodePadding() < nodePad) {
    Lib.warn('node.pad was reduced to ', sankey.nodePadding(), ' to fit within the figure.');
}

In @plotly/d3-sankey@0.7.x, calling sankey.nodePadding() after running the layout returned the effective (post-clamp) padding value. In 0.12.3 the getter returns the user-configured value instead, because upstream split the internal state into separate dy (configured) and py (effective) variables.

After the upgrade, sankey.nodePadding() always equals nodePad, so the comparison is never true and the warning never fires. The layout itself still clamps correctly - only the diagnostic is affected.

Notes

Options to address the issue:

  • Remove the warning entirely
  • Derive the effective padding from the laid-out node positions (e.g. measure the gap between consecutive nodes in the densest column)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/traces/sankey/render.js at the warning around lines 76-78, then compare the upgraded @plotly/d3-sankey v0.12.3 padding API with the laid-out node positions. Resolve how the effective padding should be detected or whether the warning should be removed, and verify that the diagnostic behavior matches the clamped layout.

Written by the indexing model from the issue text.

Assessment

Tech stack
d3, javascript
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.