windowsforms-devexpress-dot-xtracharts-dot-sankey-dot-sankeydiagramcontrol-6b7c35c1.md
Specifies the name of a data member that contains source node labels.
Namespace : DevExpress.XtraCharts.Sankey
Assembly : DevExpress.XtraCharts.v25.2.UI.dll
NuGet Package : DevExpress.Win.Charts
public string SourceDataMember { get; set; }
Public Property SourceDataMember As String
| Type | Description |
|---|---|
| String |
The name of a data source field that stores target node labels.
|
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; }
}
}
Imports System
Imports System.Collections.Generic
Imports System.Windows.Forms
Imports DevExpress.XtraCharts.Sankey
Namespace SankeySample
Public Partial Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
sankeyDiagramControl1.DataSource = GetSankeyItems()
sankeyDiagramControl1.SourceDataMember = "Source"
sankeyDiagramControl1.TargetDataMember = "Target"
sankeyDiagramControl1.WeightDataMember = "Value"
sankeyDiagramControl1.Titles.Add(New SankeyTitle With {
.Text = "Export/Import"
})
End Sub
Private Function GetSankeyItems() As List(Of SankeyItem)
Dim data As List(Of SankeyItem) = New List(Of SankeyItem) From {
New SankeyItem With {
.Source = "France", .Target = "UK", .Value = 53
},
New SankeyItem With {
.Source = "Australia", .Target = "UK", .Value = 72
},
New SankeyItem With {
.Source = "France", .Target = "Canada", .Value = 81
},
New SankeyItem With {
.Source = "China", .Target = "Canada", .Value = 96
},
New SankeyItem With {
.Source = "UK", .Target = "France", .Value = 61
},
New SankeyItem With {
.Source = "Canada", .Target = "France", .Value = 89
}
}
Return data
End Function
End Class
Public Class SankeyItem
Public Property Source As String
Public Property Target As String
Public Property Value As Double
End Class
End Namespace
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.
sankey.Colorizer = new SankeyItemColorizer(flatData);
sankey.SourceDataMember = flatData.GetDisplayTextColumn(dashboardItem.Metadata.Source.UniqueId).Name;
sankey.TargetDataMember = flatData.GetDisplayTextColumn(dashboardItem.Metadata.Target.UniqueId).Name;
sankey.Colorizer = New SankeyItemColorizer(flatData)
sankey.SourceDataMember = flatData.GetDisplayTextColumn(dashboardItem.Metadata.Source.UniqueId).Name
sankey.TargetDataMember = flatData.GetDisplayTextColumn(dashboardItem.Metadata.Target.UniqueId).Name
See Also