feat(sankey): add left and right props for layout padding control#516
Merged
mattrothenberg merged 1 commit intoMay 15, 2026
Merged
Conversation
Expose ECharts' series-level left and right options on SankeyChart so
consumers can control horizontal padding without post-mount hacks.
When omitted, ECharts defaults apply (5%). Passing left={0} right={0}
eliminates whitespace for a full-width layout.
- Add left/right to SankeyChartProps (number | string)
- Conditionally spread onto series config
- Add tests for omitted, numeric, and string values
- Add full-width demo and docs section
ada5b9c to
2f2b4a1
Compare
Collaborator
|
/bonk |
mattrothenberg
approved these changes
May 15, 2026
Contributor
PR #516 Summary: Sankey Chart Layout Padding PropsAuthor: @lkipke Changes OverviewThis PR adds two new optional props (
Technical DetailsAPI Design: interface SankeyChartProps {
left?: number | string; // px value or percentage (e.g., "5%")
right?: number | string; // px value or percentage
}Implementation approach:
Test CoverageThe 4 new tests verify:
Documentation & Demos
Current Activity
|
commit: |
Contributor
Docs PreviewCommit: |
Contributor
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.







































Summary
leftandrightoptional props toSankeyChart(number | string) for controlling horizontal padding of the Sankey layout within its container'5%'). Passingleft={0} right={0}eliminates whitespace for a full-width layoutMotivation
ECharts defaults
leftandrightto5%, but in practice the right side ends up with ~20% whitespace because ECharts auto-calculates extra space for right-aligned node labels. Consumers currently have to hack around this by grabbing the ECharts instance from the DOM after mount and callingsetOption({ series: [{ left: 0, right: 0 }] })— which is fragile and races with kumo's own option updates. First-class props are the clean solution.Changes
packages/kumo/src/components/chart/SankeyChart.tsxleft/rightto props interface, destructure in component, conditionally spread onto series config, add to useMemo depspackages/kumo/src/components/chart/SankeyChart.test.tsxpackages/kumo-docs-astro/src/components/demos/Chart/SankeyChartDemo.tsxSankeyChartFullWidthDemopackages/kumo-docs-astro/src/pages/charts/sankey.astro.changeset/sankey-left-right-props.md