Sankey mark s2 - #896
Open
tanugarg04 wants to merge 2 commits into
Open
Conversation
Ports the layout math from Workspace's own production d3.pathing() algorithm (CloudViz.js), rewritten dependency-free, into a new vega-spec-builder-s2/sankey module: topological column assignment (with cycle detection), value-proportional node/link sizing, iterative crossing-reduction relaxation, and variable-width bezier ribbon paths. Wires it into react-spectrum-charts-s2 following the Donut/Venn conventions: a pre-alpha/components/Sankey React component, an rscToSbAdapter, and children-adapter/utils wiring for chartInspects and chartPopovers (including right-click support, which required no mark-specific code since that plumbing is already generic across all marks). Node/value labels reuse Line's direct-label halo technique (background + foreground text pair) and the shared getDirectLabelFontSizeProductionRule mechanism rather than a bespoke font-size signal. Includes Storybook stories approximating Analysis Workspace's own Flow visualization, plus unit and end-to-end tests. Also saves the research doc that grounded the design decisions (planning/research/sankey-workspace-flow-feasibility.md).
- Fix duplicate ./sankeyTestUtils import in sankeyUtils.test.ts (lint error) - Remove vestigial, never-read SankeySpecOptions.backgroundColor field - Harden getSankeyEdges to drop negative/NaN/non-finite values, with a test - Shorten and tighten explanatory comments across the sankey module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a Sankey/Flow mark to React Spectrum Charts S2 (
vega-spec-builder-s2+react-spectrum-charts-s2), following the same conventions as Donut/Venn rather than the unimplemented pre-alpha spec (planning/specs/pre-alpha/sankey/add-sankey-mark.json), which this PR intentionally departs from based on the research inplanning/research/sankey-workspace-flow-feasibility/.Description
vega-spec-builder-s2/src/sankey/sankeyUtils.ts): topological column assignment with cycle detection (back edges are dropped from layering, still rendered, and reported viaconsole.warn), value-proportional node/link sizing, iterative left-right/right-left relaxation to reduce ribbon crossings, and a cubic-bezier ribbon path generator.sankeySpecBuilder.ts):addSankey/addData/addMarks/addScales/addSignals, wired intochartSpecBuilder.tsthe same way every other mark is.pre-alpha/components/Sankeycomponent,sankeyAdapter.ts, and the usual children-adapter/utils.tsallow-list wiring — mirrorsDonutexactly.ChartInspect/ChartPopover(click-to-pin and right-click) work on both the node and link layers out of the box, reusing the same generic, mark-agnostic plumbing every other mark already has — no sankey-specific code was needed for this.getDirectLabelFontSizeProductionRulefont-size mechanism, rather than a bespoke sizing signal.Basic,TwoColumnFlow,SingleChain,ThreeColumnFlow,NodeAndLinkInspect,RightClickInspect, andWorkspaceFlowExample(approximates Analysis Workspace's own Flow visualization: root node, comma-formatted counts, "+N more" long-tail nodes,s2Categorical16palette).Related Issue
Motivation and Context
How Has This Been Tested?
addData/addMarks/addScales/addSignals).vega-spec-builder-s2+react-spectrum-charts-s2suites pass (2139/2139);tsc --noEmitclean on both packages (no new errors vs. baseline);eslintclean.Screenshots (if appropriate):
Types of changes
Checklist: