SankeyDiagramControl.SourceDataMember Property
Specifies the name of a data member that contains source node labels.
Namespace: DevExpress.XtraCharts.Sankey
Assembly: DevExpress.XtraCharts.v24.2.UI.dll
Declaration
Property Value
Type | Description |
---|---|
String | The name of a data source field that stores target node labels. |
Remarks
Specify the DataSource property to bind a Sankey diagram to data. You can assign an object of a class that implements one of the following interfaces: IList, IListSource or IBindingList.
Then, define the names of data members that store data for source nodes, target nodes, and weights:
SourceDataMember
- Specifies the name of a data member that contains data for source node labels.TargetDataMember - Specifies the name of a data member that contains data for target node labels.
WeightDataMember (Optional) - Specifies the name of a data member that contains data for link weights. If unspecified, weights equal 1.
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using DevExpress.XtraCharts.Sankey;
namespace SankeySample {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e) {
sankeyDiagramControl1.DataSource = GetSankeyItems();
sankeyDiagramControl1.SourceDataMember = "Source";
sankeyDiagramControl1.TargetDataMember = "Target";
sankeyDiagramControl1.WeightDataMember = "Value";
sankeyDiagramControl1.Titles.Add(new SankeyTitle { Text = "Export/Import" });
}
List<SankeyItem> GetSankeyItems() {
List<SankeyItem> data = new List<SankeyItem> {
new SankeyItem { Source = "France", Target = "UK", Value = 53 },
new SankeyItem { Source = "Australia", Target = "UK", Value = 72 },
new SankeyItem { Source = "France", Target = "Canada", Value = 81 },
new SankeyItem { Source = "China", Target = "Canada", Value = 96 },
new SankeyItem { Source = "UK", Target = "France", Value = 61 },
new SankeyItem { Source = "Canada", Target = "France", Value = 89 },
};
return data;
}
}
public class SankeyItem {
public string Source { get; set; }
public string Target { get; set; }
public double Value { get; set; }
}
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the SourceDataMember property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.