You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: Apply sankey node.x / node.y of 0 instead of positioning the node automatically - #8158
Apply a sankey node position of 0 in node.x or node.y. Before this change, the layout placed such a node automatically.
Changes
In src/traces/sankey/render.js, the force-node-position loop tested trace.node.x[p] && trace.node.y[p]. The value 0 is falsy, so the loop skipped the node. The loop now tests != null, so only a missing value skips the node.
Add a jasmine test in test/jasmine/tests/sankey_test.js that places nodes at x = 0 and y = 0.
Add a draftlog.
Testing
npm run test-jasmine -- sankey --nowatch: 92 of 92 specs pass.
npm run lint, npm run typecheck and npm run test-syntax pass.
I rendered the snippet from the issue before and after the change. After the change, the center of node a is at the top-left corner.
The mock sankey_x_y_with_arrows sets y: [0, 0, 0], so its baseline changes: its nodes now sit at the top of the plot. No other sankey mock has a 0 coordinate. The new baseline will come from the baselines-default-diff CI artifact.
…cally
The force-node-position loop tested node.x and node.y for truthiness, so a
coordinate of 0 counted as missing and the node was positioned by the
layout instead. Test for null and undefined only.
Description
Closes #8150.
Apply a sankey node position of
0innode.xornode.y. Before this change, the layout placed such a node automatically.Changes
src/traces/sankey/render.js, the force-node-position loop testedtrace.node.x[p] && trace.node.y[p]. The value0is falsy, so the loop skipped the node. The loop now tests!= null, so only a missing value skips the node.test/jasmine/tests/sankey_test.jsthat places nodes atx = 0andy = 0.Testing
npm run test-jasmine -- sankey --nowatch: 92 of 92 specs pass.npm run lint,npm run typecheckandnpm run test-syntaxpass.ais at the top-left corner.sankey_x_y_with_arrowssetsy: [0, 0, 0], so its baseline changes: its nodes now sit at the top of the plot. No other sankey mock has a0coordinate. The new baseline will come from thebaselines-default-diffCI artifact.This change was developed with AI assistance.