When to Use This Skill
Use this skill when the user needs to:
- Create Sankey diagrams in ASP.NET MVC applications to visualize the flow of values between categories
- Visualize weighted relationships with source and target nodes connected by value-based links
- Customize appearance of nodes, links, labels, legends, tooltips, title, and chart layout
- Implement interactivity with node and link events, tooltip customization, highlighting, and hover behavior
- Configure export and print functionality for PNG, JPEG, SVG, and PDF output
- Support multiple orientations using horizontal or vertical layouts
- Support RTL layouts for right-to-left languages and applications
- Improve accessibility with focus border settings, localization, and keyboard-friendly rendering
- Apply responsive behavior using flexible width and height values plus load-time layout adjustments
Component Overview
The Syncfusion Sankey Chart is a flow-visualization component in Syncfusion.EJ2.Charts that renders nodes and weighted links using SVG. It is designed for scenarios where values move from one category to another and the connection thickness represents the magnitude of flow.
It provides:
- Strongly typed node and link collections through
List<SankeyNode>andList<SankeyLink> - Configurable node and link appearance using
NodeStyleandLinkStyle - Interactive features including labels, legends, tooltips, hover states, and click events
- Lifecycle and rendering events for fine-grained customization
- Print and export support for PNG, JPEG, SVG, and PDF
- Orientation support for horizontal and vertical flow layouts
- RTL support for right-to-left user interfaces
- Accessibility options including focus border settings and localization support
Quick Start Example
Here is a minimal and runnable ASP.NET MVC Sankey Chart implementation using the actual node and link API pattern.
Model
using System.Collections.Generic;
using Syncfusion.EJ2.Charts;
namespace WebApplication1.Models
{
public class SankeyViewModel
{
public List<SankeyNode> SankeyNodes { get; set; }
public List<SankeyLink> SankeyLinks { get; set; }
}
}
Controller
using System.Collections.Generic;
using System.Web.Mvc;
using Syncfusion.EJ2.Charts;
using WebApplication1.Models;
namespace WebApplication1.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
var model = new SankeyViewModel
{
SankeyNodes = new List<SankeyNode>
{
new SankeyNode
{
Id = "Product A",
Color = "#FF6B6B",
Label = new SankeyChartDataLabel { Text = "Product A" }
},
new SankeyNode
{
Id = "Product B",
Color = "#4ECDC4",
Label = new SankeyChartDataLabel { Text = "Product B" }
},
new SankeyNode
{
Id = "Sales",
Color = "#95E1D3",
Label = new SankeyChartDataLabel { Text = "Sales" }
},
new SankeyNode
{
Id = "Revenue",
Color = "#60A5FA",
Label = new SankeyChartDataLabel { Text = "Revenue" }
}
},
SankeyLinks = new List<SankeyLink>
{
new SankeyLink { SourceId = "Product A", TargetId = "Sales", Value = 100 },
new SankeyLink { SourceId = "Product B", TargetId = "Sales", Value = 80 },
new SankeyLink { SourceId = "Sales", TargetId = "Revenue", Value = 180 }
}
};
return View(model);
}
}
}
View
@model WebApplication1.Models.SankeyViewModel
@using Syncfusion.EJ2
@using Syncfusion.EJ2.Charts
@Html.EJS().Sankey("sankey")
.Width("100%")
.Height("500px")
.Title("Product Sales Flow")
.Nodes(Model.SankeyNodes)
.Links(Model.SankeyLinks)
.Render()
@Html.EJS().ScriptManager()
Common Patterns
Pattern 1: Basic Sankey with Strongly Typed Nodes and Links
- Create a view model with
SankeyNodesandSankeyLinks - Populate
SankeyNodeobjects withId, optionalColor, optionalLabel, and optionalOffset - Populate
SankeyLinkobjects withSourceId,TargetId, andValue - Bind them through
.Nodes(...)and.Links(...)
Pattern 2: Customized Appearance
- Use
NodeStyle(...)for global node width, opacity, and related appearance settings - Use
LinkStyle(...)for opacity, curvature, and color behavior - Use
LabelSettings(...)for label visibility, color, font family, font size, weight, style, and padding - Use
Background(...),Border(...),Margin(...), andTheme(...)for overall visual styling
Pattern 3: Interactive Sankey with Events
- Implement
NodeRendering(...)to customize nodes at render time - Implement
LinkRendering(...)to customize links at render time - Implement
LabelRendering(...)for dynamic label text - Implement
TooltipRendering(...)for node or link tooltip customization - Handle
NodeClick(...),LinkClick(...),NodeEnter(...),NodeLeave(...),LinkEnter(...), andLinkLeave(...)
Pattern 4: Export and Print
- Configure
BeforeExport(...),ExportCompleted(...), andBeforePrint(...) - Retrieve the client-side instance from
ej2_instances - Call
export("PNG", "file-name"),export("PDF", "file-name"), orprint() - If runtime export styling is needed, apply it before export and restore it after export completes
Pattern 5: Responsive Sankey
- Use percentage width such as
"100%" - Set height directly or update it in
Load(...) - For device-specific layout changes, detect device state in the load event
- Optionally switch
Orientationbased on device type or available space
Pattern 6: Accessible Sankey
- Use
Accessibility,Locale,EnableRtl, and focus border properties where needed - Ensure labels and tooltip text are readable
- Avoid relying only on color to communicate meaning
- Keep interaction patterns consistent for keyboard and pointer users
Key Configuration Properties
| Property | Purpose | Common Values |
|---|---|---|
Nodes |
Defines node collection | List<SankeyNode> |
Links |
Defines link collection | List<SankeyLink> |
NodeStyle |
Global node appearance | width, opacity |
LinkStyle |
Global link appearance | opacity, curvature, color type |
LabelSettings |
Global label appearance | visible, color, font settings, padding |
LegendSettings |
Legend layout and styling | visible, position, width, height, opacity |
Tooltip |
Tooltip appearance and formatting | enable, node format, link format, fill |
Title |
Main chart title | string |
SubTitle |
Secondary title text | string |
Orientation |
Flow layout direction | Horizontal, Vertical |
Background |
Chart background color | CSS color string |
Border |
Chart outer border | color, width |
Margin |
Chart outer margin | left, right, top, bottom |
Theme |
Built-in theme | Material, Fluent, Bootstrap5, Tailwind, and related variants |
EnableRtl |
Right-to-left rendering | true, false |
Locale |
Localization support | locale code string |
Documentation and Navigation Guide
Use these reference files for specific implementation tasks:
Getting Started
📄 Read: references/getting-started.md
Use this guide when setting up the Sankey Chart for the first time in an ASP.NET MVC application.
- Install the required Syncfusion NuGet packages
- Configure Syncfusion namespaces in
Views/Web.config - Add required CSS and JavaScript resources (CDN or local)
- Register and use the Syncfusion ScriptManager
- Initialize the Sankey chart with strongly typed nodes and links
- Understand the expected data structure and binding pattern
Node Customization
📄 Read: references/nodes-customization.md
Use this guide to control how Sankey nodes look and behave.
- Configure global node styling using
.NodeStyle(...) - Set node colors, fills, borders, and opacity
- Adjust node spacing and vertical alignment using offsets
- Apply conditional styling using
NodeRendering(...) - Implement per-node appearance logic without breaking layout stability
Link Configuration
📄 Read: references/links-configuration.md
Use this guide to customize the visual and behavioral aspects of Sankey links.
- Understand how link values control thickness automatically
- Configure link curvature and transparency
- Apply built-in color behavior (source, target, or blend)
- Customize individual links using
LinkRendering(...) - Update and rebind link data dynamically at runtime
Labels and Rendering
📄 Read: references/labels-rendering.md
Use this guide to manage node labels and their presentation.
- Enable or disable labels using
LabelSettings(...) - Configure label font, size, color, and padding
- Conditionally hide or modify labels
- Customize label text per node using
LabelRendering(...) - Handle both server-side and client-side label scenarios
Legends Management
📄 Read: references/legends-management.md
Use this guide to configure and control the Sankey legend.
- Show or hide the legend
- Position the legend around the chart or at a custom location
- Style legend background, text, shapes, and spacing
- Modify legend items using
LegendItemRendering(...) - Integrate legend highlighting with node and link interaction
Tooltips and Interactions
📄 Read: references/tooltips-interactions.md
Use this guide to add interactivity and user feedback.
- Enable and configure Sankey tooltips
- Customize tooltip content using
TooltipRendering(...) - Display node- or link-specific details
- Handle node and link click events
- Implement hover-based highlighting and interaction workflows
Orientation and RTL
📄 Read: references/orientation-and-rtl.md
Use this guide to control layout direction and internationalization behavior.
- Switch between horizontal and vertical Sankey layouts
- Enable Right-to-Left (RTL) rendering
- Combine RTL with horizontal or vertical orientation
- Adjust sizing, spacing, and layout for different orientations
- Implement responsive orientation strategies
Title and Formatting
📄 Read: references/title-and-formatting.md
Use this guide to format chart titles and subtitles.
- Set title and subtitle text
- Style fonts, sizes, colors, and weights
- Control text alignment and visual hierarchy
- Dynamically update title content at runtime
- Decide when to use built-in titles versus external HTML headings
Accessibility
📄 Read: references/accessibility-features.md
Use this guide to make the Sankey chart accessible and inclusive.
- Apply focus border settings for keyboard navigation
- Support RTL and localized content
- Use accessible label and tooltip practices
- Improve screen reader compatibility
- Ensure sufficient color contrast and interaction clarity
Print and Export
📄 Read: references/print-and-export.md
Use this guide to support printing and exporting the Sankey chart.
- Export the chart to PNG, JPEG, SVG, and PDF formats
- Trigger print using the built-in Sankey print method
- Handle export lifecycle events
- Customize file names, metadata, and backgrounds
- Build user-friendly export and print toolbars
API Reference
📄 Read: references/api-reference.md
Use this guide as the authoritative reference for all supported APIs.
- Full
Sankeycomponent API surface - Properties with types and documented default values
- Node, Link, Label, Legend, and Tooltip configuration classes
- Border, Margin, Orientation, Theme, and Title-related APIs
- All lifecycle, rendering, interaction, and export/print events
- Enumerations and related helper classes
- Namespace and assembly details
Quick Decision Tree
What do you need?
- Install and set up? → getting-started.md
- Style nodes? → nodes-customization.md
- Style links? → links-configuration.md
- Show and customize labels? → labels-rendering.md
- Add or customize legend? → legends-management.md
- Add or customize tooltips? → tooltips-interactions.md
- Switch orientation or use RTL? → orientation-and-rtl.md
- Add title and subtitle? → title-and-formatting.md
- Improve accessibility? → accessibility-features.md
- Export or print? → print-and-export.md
- Need the full class and property map? → api-reference.md
Common Use Cases
-
Supply chain visualization
Show the flow from suppliers to warehouses to customers. -
Financial analysis
Display money flow from sources to departments to net outcome. -
User journey visualization
Track movement from traffic sources to onboarding to activation. -
Energy flow visualization
Show distribution from sources to intermediate systems to consumption points. -
Data pipeline monitoring
Visualize movement through ingestion, transformation, and output stages. -
Resource distribution
Show allocation of time, budget, or staffing across categories.