SankeyChart: Add multiple convenience features#12064
SankeyChart: Add multiple convenience features#12064danielchalmers merged 10 commits intoMudBlazor:devfrom
Conversation
|
Note that there should be no breaking changes (idk why the breaking change label was added) |
If you're curious, this was its thought process:
It takes it purely from the body/comments but doesn't take into account the actual code changes |
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the Sankey chart component to add configurability and improve functionality. It introduces new filtering options, customizable padding for tooltips and labels, and fixes several calculation issues.
Key changes:
- Added configurable padding for chart tooltips and node labels via
PaddingSizeandLabelPaddingproperties - Implemented filtering options (
HideNodesSmallerThan,HideNodesWithNoEdges,OrderNodesByValue) - Fixed edge path calculations and center positioning
- Added constructor overload for
SankeyChartNodeto accept color parameter
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| ChartTooltip.razor.cs | Converted hardcoded padding constant to configurable parameter PaddingSize |
| ChartTooltip.razor | Updated HTML comments for clarity |
| SankeyChartNode.cs | Added constructor overload accepting color parameter |
| NodeChartOptions.cs | Added new configuration properties for label padding, node filtering, edge symbols, and ordering |
| Sankey.razor.cs | Refactored drawing logic to support filtering, fixed edge path calculations and center positioning |
| Sankey.razor | Added support for configurable label padding, fixed glow filter naming |
| SankeyChartTests.cs | Updated test expectations to match new edge path calculations |
| SankeyExample2.razor | Complete rewrite with dynamic data generation and interactive configuration controls |
| SankeyExample1.razor | Simplified to basic usage example |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/MudBlazor.Docs/Pages/Components/Charts/Examples/SankeyExample2.razor
Show resolved
Hide resolved
|
Thank you again! |
|
@91378246 quick question on this. You added a number of option and I'm wondering about
Are both of these required? If a node has no edges, then it should automatically be 0 right? Wouldn't hiding nodes smaller than 1 exclude nodes with no edges without the additional option? Is the |
|
@Anu6is If you use a Sankey chart in health sciences you often have hundreds of nodes. I added |
This PR enhances the Sankey chart by adding multiple convenience features as well as fixing 2 small optical issues:
NodeChartOptions.EdgeLabelSymbolallows for setting a custom edge label symbol to be displayed in the edge labelsNodeChartOptions.LabelPaddingallows for setting a customChartTooltippadding, which may be required for very large Sankey chartsNodeChartOptions.HideNodesSmallerThanautomatically hides nodes below a certain threshold (again for large charts)NodeChartOptions.HideNodesWithNoEdgesautomatically hides nodes with no connectionsNodeChartOptions.OrderNodesByValueorders the nodes in each column by their corresponding value descendingChartTooltip.PaddingSizeto a parameter