-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
feat(sankey): add Apple-style rendering with smart labels and custom node colors #7272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
feat(sankey): add Apple-style rendering with smart labels and custom node colors #7272
Conversation
- Implement collapsible nodes with recursive pruning - Auto-zoom layout to fill canvas when nodes are hidden - Strict CSV order sorting for stable node positions - Target-based link coloring with transparency and blend mode - Smart indicator icons (only shown when collapsed) - Smooth fade animations for enter/exit transitions
- Add precomputed topology to identify central node (max flow) - Central node (Revenue) can collapse both left and right sides - Other nodes can only collapse their children direction - Auto-zoom: remaining nodes expand to fill canvas after collapse - Collapse animation: nodes shrink towards anchor, expand from anchor - Central node is 1.5x wider for visual emphasis - Indicators show collapse state with directional arrows
…node colors - Add smart label positioning based on node layer relative to central node - Add outlined label style (labelStyle: 'outlined') as new default - Add nodeColors config option for custom node color mapping - Add configurable nodeWidth and nodePadding options - Update styles.js with new CSS for outlined labels - Fix YAML frontmatter indentation in demos/sankey.html - Add Cypress tests for new features BREAKING CHANGE: labelStyle now defaults to 'outlined' instead of 'default'
|
✅ Deploy Preview for mermaid-js ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
@mermaid-js/examples
mermaid
@mermaid-js/layout-elk
@mermaid-js/layout-tidy-tree
@mermaid-js/mermaid-zenuml
@mermaid-js/parser
@mermaid-js/tiny
commit: |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #7272 +/- ##
=======================================
Coverage 3.57% 3.57%
=======================================
Files 473 473
Lines 47475 47551 +76
Branches 734 734
=======================================
+ Hits 1696 1699 +3
- Misses 45779 45852 +73
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
- Rename labelStyle 'outlined' to 'default' (new default behavior) - Rename labelStyle 'default' to 'legacy' (original behavior) - Remove demo-sankey.html (demonstration file only) - Update tests, demo, and renderer for new naming
…ocs build The curly braces in the YAML description were being parsed as Vue template syntax, causing a 'Duplicate attribute' error during vitepress docs build.
📑 Summary
This PR adds Apple-style rendering enhancements to Sankey diagrams, including smart label positioning, outlined labels, and custom node colors.
Resolves #6129 - Sankey improvements: Let user specify node and path color
Related to #6290 - This PR provides an alternative/extended implementation with additional features beyond custom colors.
✨ New Features
1. Custom Node Colors (
nodeColors)Allows specifying colors for individual nodes via frontmatter config:
2. Outlined Labels (
labelStyle: 'default')New default label style with white stroke background for better readability on dark backgrounds.
To use the original plain text labels, set
labelStyle: 'legacy'.3. Smart Label Positioning
Labels automatically position based on node layer relative to the central node (node with maximum value):
4. Configurable Layout
New options:
nodeWidth: Width of node rectangles (default: 10)nodePadding: Padding between nodes (default: 12)📏 Design Decisions
nodeColorsvscolors: UsednodeColors(object mapping node ID → color) for clarity. Nodes not specified fall back to default D3 color scheme.labelStyleenum:'default'= outlined labels (new),'legacy'= plain text labels (original). No breaking change since'default'is now the default.📋 Tasks
Energy Demo
Before

After

Apple Finance
Before

After
