Your search did not match any results.

Charts - Overview

The Sankey chart visualizes the flow magnitude between value sets. Flow values are nodes, and the connections between nodes are links. The higher the flow magnitude, the wider the link is.

Backend API
@(Html.DevExtreme().Sankey() .ID("sankey") .Title(t=>t.Text("Commodity Turnover in 2017")) .SourceField("Source") .TargetField("Target") .WeightField("Weight") .Node(n => n.Width(8) .Padding(30) ) .Link(l => l.ColorMode(SankeyColorMode.Gradient)) .Tooltip(t => t .Enabled(true) .CustomizeLinkTooltip( @<text> function(info) { return { html: "<b>From:</b> " + info.source + "<br/><b>To:</b> " + info.target + "<br/>" + "<b>Weight:</b> " + info.weight }; } </text>) ) .DataSource(new[] { new { Source = "Spain", Target = "United States of America", Weight = 2 }, new { Source = "Germany", Target = "United States of America", Weight = 8 }, new { Source = "France", Target = "United States of America", Weight = 4 }, new { Source = "Germany", Target = "Great Britain", Weight = 2 }, new { Source = "France", Target = "Great Britain", Weight = 4 }, new { Source = "United States of America", Target = "Australia", Weight = 6 }, new { Source = "United States of America", Target = "New Zealand", Weight = 5 }, new { Source = "United States of America", Target = "Japan", Weight = 3 }, new { Source = "Great Britain", Target = "New Zealand", Weight = 4 }, new { Source = "Great Britain", Target = "Japan", Weight = 1 }, }) )
using DevExtreme.AspNet.Data; using DevExtreme.AspNet.Mvc; using DevExtreme.MVC.Demos.Models.SampleData; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Web.Mvc; namespace DevExtreme.MVC.Demos.Controllers { public class ChartsController : Controller { public ActionResult SankeyChart() { return View(); } } }
#sankey { height: 440px; }

Bind Sankey to Data

Each object of your data source should be a link between source and target nodes. For example, the following link connects the Spain and USA nodes and has a weight of 2:

{ source: 'Spain', target: 'USA', weight: 2 }

To bind Sankey to data fields, use the sourceField, targetField, and weightField properties.

Customize Node and Link Appearance

Use the node and link objects to configure Sankey appearance. This demo specifies the width and padding properties for nodes and the colorMode property for links.

Configure the Tooltip

The tooltip content differs for nodes and links. When you hover over a node, the tooltip shows the node's title, and its incoming and outgoing weights. When you hover over a link, the tooltip shows the link's direction and weight.

To customize the tooltip content, use the customizeNodeTooltip and customizeLinkTooltip functions. In this demo, you can see an example of the customizeLinkTooltip function.