Skip to main content
All docs
V26.1
  • SankeyDiagramControl.SourceDataMember Property

    Specifies the name of a data member that contains source node labels.

    Namespace: DevExpress.XtraCharts.Sankey

    Assembly: DevExpress.XtraCharts.v26.1.UI.dll

    NuGet Package: DevExpress.Win.Charts

    Declaration

    public string SourceDataMember { get; set; }

    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; }
        }
    }
    
    See Also