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 : MermaidChartRemarks
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
MermaidChartSankeyChart
Constructors
| Name | Description |
|---|---|
| SankeyChart() |
SankeyChart()
SankeyChart.cspublic SankeyChart()No documentation is available.
Properties
| Name | Description |
|---|---|
| Height | 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. |
| LabelStyle | 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. |
| LinkColor | Gets or sets the color of every link, or null to color them as SankeyChart.LinkColoring says. |
| LinkColoring | 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. |
| Links | Gets the links, in their order: the nodes are ordered by their first appearance in the links. |
| NodeAlignment | Gets or sets how the nodes are placed in columns. The default is SankeyNodeAlignment.Justify. |
| NodeColors | Gets the colors of the nodes, by name. The other nodes take the colors of the Tableau 10 scheme, in their order. |
| NodePadding | 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. |
| NodeWidth | Gets or sets the width of the rectangles of the nodes, in pixels. The default is 10. |
| ShowValues | Gets or sets a value that indicates whether the labels of the nodes show their value. The default is true. |
| ValuePrefix | Gets or sets the text written before the values, such as a currency symbol. The default is an empty text. |
| ValueSuffix | Gets or sets the text written after the values, such as a unit. The default is an empty text. |
| Width | 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. |
Height
SankeyChart.csGets 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; }LabelStyle
SankeyChart.csGets 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
LinkColor
SankeyChart.csGets or sets the color of every link, or null to color them as SankeyChart.LinkColoring says.
public SceneColor? LinkColor { get; set; }Property value
LinkColoring
SankeyChart.csGets 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
Links
SankeyChart.csGets the links, in their order: the nodes are ordered by their first appearance in the links.
public IList<SankeyLink> Links { get; }Property value
NodeAlignment
SankeyChart.csGets or sets how the nodes are placed in columns. The default is SankeyNodeAlignment.Justify.
public SankeyNodeAlignment NodeAlignment { get; set; }Property value
NodeColors
SankeyChart.csGets 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; }Property value
NodePadding
SankeyChart.csGets 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; }NodeWidth
SankeyChart.csGets or sets the width of the rectangles of the nodes, in pixels. The default is 10.
public double NodeWidth { get; set; }ShowValues
SankeyChart.csValuePrefix
SankeyChart.csValueSuffix
SankeyChart.csWidth
SankeyChart.csGets 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; }Methods
| Name | Description |
|---|---|
| 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.csAdds a link.
public SankeyLink AddLink(string source, string target, double value)Parameters
sourcestring- The name of the node the flow comes from.
targetstring- The name of the node the flow goes to.
valuedouble- The quantity, which gives the width of the link.
Returns
SankeyLink The link.
Exceptions
ArgumentOutOfRangeExceptionvalueis negative, not finite or larger than 1E+300.
GetNodes()
SankeyChart.csReturns 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.