SankeyChart Class

A sankey diagram: flows between nodes, drawn as links whose width is proportional to their quantity, between nodes placed in columns (Mermaid sankey). The nodes are the sources and the targets of the links, named by them; the chart is drawn with the SankeyMark<T> of Meziantou.Framework.Charts, whose layout is the one of d3-sankey, which Mermaid uses.

public sealed class SankeyChart : MermaidChart

Remarks

The links must not form a cycle: a link that closes a cycle is not drawn, nor a node that only such links name.

Inheritance
MermaidChart SankeyChart

Constructors

NameDescription
SankeyChart()

SankeyChart()

SankeyChart.cs
public SankeyChart()

No documentation is available.

Properties

NameDescription
HeightGets or sets the height of the area of the nodes and the links, in pixels, without the title and the margins of the chart. The default is 400.
LabelStyleGets or sets how the labels of the nodes are drawn. The default is SankeyLabelStyle.Legacy. SankeyLabelStyle.Outlined is written back but not drawn: the labels are always drawn as SankeyLabelStyle.Legacy.
LinkColorGets or sets the color of every link, or null to color them as SankeyChart.LinkColoring says.
LinkColoringGets or sets how the links are colored when SankeyChart.LinkColor is null. The default is SankeyLinkColoring.Gradient, which is written back but drawn as SankeyLinkColoring.Source.
LinksGets the links, in their order: the nodes are ordered by their first appearance in the links.
NodeAlignmentGets or sets how the nodes are placed in columns. The default is SankeyNodeAlignment.Justify.
NodeColorsGets the colors of the nodes, by name. The other nodes take the colors of the Tableau 10 scheme, in their order.
NodePaddingGets or sets the vertical space between the nodes of a column, in pixels, increased by 15 when SankeyChart.ShowValues is set. The default is 12.
NodeWidthGets or sets the width of the rectangles of the nodes, in pixels. The default is 10.
ShowValuesGets or sets a value that indicates whether the labels of the nodes show their value. The default is true.
ValuePrefixGets or sets the text written before the values, such as a currency symbol. The default is an empty text.
ValueSuffixGets or sets the text written after the values, such as a unit. The default is an empty text.
WidthGets or sets the width of the area of the nodes and the links, in pixels, without the margins of the chart. The default is 600.

Gets or sets the height of the area of the nodes and the links, in pixels, without the title and the margins of the chart. The default is 400.

public double Height { get; set; }

Property value

double

Exceptions

ArgumentOutOfRangeException
The value is not between 1 and 10,000.

LabelStyle

SankeyChart.cs

Gets or sets how the labels of the nodes are drawn. The default is SankeyLabelStyle.Legacy. SankeyLabelStyle.Outlined is written back but not drawn: the labels are always drawn as SankeyLabelStyle.Legacy.

public SankeyLabelStyle LabelStyle { get; set; }

Property value

SankeyLabelStyle

Gets or sets the color of every link, or null to color them as SankeyChart.LinkColoring says.

public SceneColor? LinkColor { get; set; }

Property value

SceneColor?

LinkColoring

SankeyChart.cs

Gets or sets how the links are colored when SankeyChart.LinkColor is null. The default is SankeyLinkColoring.Gradient, which is written back but drawn as SankeyLinkColoring.Source.

public SankeyLinkColoring LinkColoring { get; set; }

Property value

SankeyLinkColoring

NodeAlignment

SankeyChart.cs

Gets or sets how the nodes are placed in columns. The default is SankeyNodeAlignment.Justify.

public SankeyNodeAlignment NodeAlignment { get; set; }

Property value

SankeyNodeAlignment

NodeColors

SankeyChart.cs

Gets the colors of the nodes, by name. The other nodes take the colors of the Tableau 10 scheme, in their order.

public IDictionary<string, SceneColor> NodeColors { get; }

NodePadding

SankeyChart.cs

Gets or sets the vertical space between the nodes of a column, in pixels, increased by 15 when SankeyChart.ShowValues is set. The default is 12.

public double NodePadding { get; set; }

Property value

double

Exceptions

ArgumentOutOfRangeException
The value is not between 0 and 1,000.

Gets or sets the width of the rectangles of the nodes, in pixels. The default is 10.

public double NodeWidth { get; set; }

Property value

double

Exceptions

ArgumentOutOfRangeException
The value is not between 0 and 1,000.

ShowValues

SankeyChart.cs

Gets or sets a value that indicates whether the labels of the nodes show their value. The default is true.

public bool ShowValues { get; set; }

Property value

bool

ValuePrefix

SankeyChart.cs

Gets or sets the text written before the values, such as a currency symbol. The default is an empty text.

public string ValuePrefix { get; set; }

Property value

string

ValueSuffix

SankeyChart.cs

Gets or sets the text written after the values, such as a unit. The default is an empty text.

public string ValueSuffix { get; set; }

Property value

string

Gets or sets the width of the area of the nodes and the links, in pixels, without the margins of the chart. The default is 600.

public double Width { get; set; }

Property value

double

Exceptions

ArgumentOutOfRangeException
The value is not between 1 and 10,000.

Methods

NameDescription
AddLink(string, string, double)Adds a link.
GetNodes()Returns the names of the nodes, by order of their first appearance in the links, the source of a link before its target.

AddLink(string, string, double)

SankeyChart.cs

Adds a link.

public SankeyLink AddLink(string source, string target, double value)

Parameters

source string
The name of the node the flow comes from.
target string
The name of the node the flow goes to.
value double
The quantity, which gives the width of the link.

Returns

SankeyLink The link.

Exceptions

ArgumentOutOfRangeException
value is negative, not finite or larger than 1E+300.

GetNodes()

SankeyChart.cs

Returns the names of the nodes, by order of their first appearance in the links, the source of a link before its target.

public IReadOnlyList<string> GetNodes()

Returns

IReadOnlyList<string> The names of the nodes.