blazor-devexpress-dot-blazor-dot-dxsankey-feb72cab.md
Specifies the sort order of Sankey nodes in corresponding columns.
Namespace : DevExpress.Blazor
Assembly : DevExpress.Blazor.v25.2.dll
NuGet Package : DevExpress.Blazor
[Parameter]
public Dictionary<string, int> SortOrder { get; set; }
| Type | Description |
|---|---|
| Dictionary<String, Int32> |
A collection of nodes and their weights.
|
The Sankey component arranges nodes in columns based on node weights: the heavier the weight, the lower the node appears in the corresponding column. The default weight of all Sankey nodes is 1 – the component displays nodes in the order they are declared in the data source.
The Sankey component allows you to change the default node arrangement: assign a collection of nodes and their new weights to the SortOrder property.
<DxSankey Data="@Data"
Width="100%"
Height="440px"
SortOrder="@SortOrder"
SourceFieldName="Source"
TargetFieldName="Target"
WeightFieldName="Weight">
@* ... *@
</DxSankey>
@code {
IEnumerable<SankeyDataPoint> Data = Enumerable.Empty<SankeyDataPoint>();
protected override void OnInitialized() {
Data = GenerateData();
}
Dictionary<string, int> SortOrder = new Dictionary<string, int>() {
{ "Spain", 3 },
{ "France", 2 },
{ "New Zealand", 3 }
};
}
public List<SankeyDataPoint> GenerateData() {
return new List<SankeyDataPoint>() {
new SankeyDataPoint("Spain", "United States of America", 2),
new SankeyDataPoint("Germany", "United States of America", 8),
new SankeyDataPoint("France", "United States of America", 4),
new SankeyDataPoint("Germany", "Great Britain", 2),
new SankeyDataPoint("France", "Great Britain", 4),
new SankeyDataPoint("United States of America", "Australia", 6),
new SankeyDataPoint("United States of America", "New Zealand", 5),
new SankeyDataPoint("United States of America", "Japan", 3),
new SankeyDataPoint("Great Britain", "New Zealand", 4),
new SankeyDataPoint("Great Britain", "Japan", 1),
};
}
public class SankeyDataPoint {
public string Source { get; set; }
public string Target { get; set; }
public int Weight { get; set; }
public SankeyDataPoint(string source, string target, int weight) {
Source = source;
Target = target;
Weight = weight;
}
}
See Also