| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
The warning compared the layout getter sankey.nodePadding() against the configured node.pad. Since @plotly/d3-sankey 0.12.3 (plotly#7830) that getter returns the *configured* value (the post-clamp padding lives in an internal variable), so the comparison never fired and users no longer learn their pad was reduced. Measure the smallest gap between consecutive nodes sharing a column instead: it reflects the effective padding and works for both @plotly/d3-sankey and @plotly/d3-sankey-circular. Fixes plotly#7832
|
Thanks for the PR! Before reviewing this, let's discuss the potential solutions in the issue. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #7832.
Problem
The warning in src/traces/sankey/render.js compared sankey.nodePadding() against the configured node.pad. Since the upgrade to @plotly/d3-sankey@0.12.3 (#7830), that getter returns the configured value — the post-clamp padding is kept in an internal variable (py, computed in computeNodeBreadths) and never exposed:
So after #7830 users are no longer warned when their node.pad is clamped to fit the figure. The layout itself still clamps correctly; only the diagnostic broke.
Fix
Measure the effective padding from the laid-out node positions instead of asking the generator: group nodes by column (x0 when horizontal, else y0), sort each column along its position axis, and take the smallest gap between consecutive nodes. This reflects the post-clamp padding and works identically for both @plotly/d3-sankey and @plotly/d3-sankey-circular (whose getter has the same configured-value behavior). The warning now reports the effective value rounded to 2 decimals.
Verification