TreemapChart Class

A treemap: a hierarchy drawn as nested rectangles, each leaf with an area proportional to its value, each section around its children with its name and its total (Mermaid treemap). It is drawn with the TreemapMark<T> of Meziantou.Framework.Charts, whose squarified layout is the one of d3-hierarchy that Mermaid uses, and the nodes of each section are sorted by decreasing value.

public sealed class TreemapChart : MermaidChart
Inheritance
MermaidChart TreemapChart

Constructors

NameDescription
TreemapChart()

TreemapChart()

TreemapChart.cs
public TreemapChart()

No documentation is available.

Properties

NameDescription
ClassDefinitionsGets the styles of the classes of the nodes, by name (Mermaid classDef). The fill and the opacity of a style color the nodes of its class; the border, the text and the font of a style are written back but not drawn.
DiagramPaddingGets or sets the space around the top-level nodes, in pixels (Mermaid diagramPadding). The default is 8.
InnerPaddingGets or sets the space between the nodes of a section, in pixels (Mermaid padding). The default is 10.
NodeHeightGets or sets a tenth of the height of the treemap, in pixels, as the nodeHeight of Mermaid. The default is 40: the treemap is laid out in 400 pixels.
NodeWidthGets or sets a tenth of the width of the treemap, in pixels, as the nodeWidth of Mermaid. The default is 100: the treemap is laid out in 1,000 pixels.
NodesGets the top-level nodes.
ShowValuesGets or sets a value that indicates whether the values of the nodes are drawn: under the names of the leaves, and after the names of the sections. The default is true.
ValueFormatGets or sets the format of the values: a format specifier of d3-format, such as , (the default, with thousands separators), .1f or .0%, optionally after a $, as in Mermaid. An invalid format falls back to ,. A leaf shows its value under its name, and a section after its name.

ClassDefinitions

TreemapChart.cs

Gets the styles of the classes of the nodes, by name (Mermaid classDef). The fill and the opacity of a style color the nodes of its class; the border, the text and the font of a style are written back but not drawn.

public IDictionary<string, DiagramStyle> ClassDefinitions { get; }

DiagramPadding

TreemapChart.cs

Gets or sets the space around the top-level nodes, in pixels (Mermaid diagramPadding). The default is 8.

public double DiagramPadding { get; set; }

Property value

double

Exceptions

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

InnerPadding

TreemapChart.cs

Gets or sets the space between the nodes of a section, in pixels (Mermaid padding). The default is 10.

public double InnerPadding { get; set; }

Property value

double

Exceptions

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

NodeHeight

TreemapChart.cs

Gets or sets a tenth of the height of the treemap, in pixels, as the nodeHeight of Mermaid. The default is 40: the treemap is laid out in 400 pixels.

public double NodeHeight { get; set; }

Property value

double

Exceptions

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

Gets or sets a tenth of the width of the treemap, in pixels, as the nodeWidth of Mermaid. The default is 100: the treemap is laid out in 1,000 pixels.

public double NodeWidth { get; set; }

Property value

double

Exceptions

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

Gets the top-level nodes.

public IList<TreemapNode> Nodes { get; }

Property value

IList<TreemapNode>

ShowValues

TreemapChart.cs

Gets or sets a value that indicates whether the values of the nodes are drawn: under the names of the leaves, and after the names of the sections. The default is true.

public bool ShowValues { get; set; }

Property value

bool

ValueFormat

TreemapChart.cs

Gets or sets the format of the values: a format specifier of d3-format, such as , (the default, with thousands separators), .1f or .0%, optionally after a $, as in Mermaid. An invalid format falls back to ,. A leaf shows its value under its name, and a section after its name.

public string ValueFormat { get; set; }

Property value

string

Methods

NameDescription
AddNode(string, double?)Adds a top-level node.
EnumerateNodes()Enumerates the nodes and their descendants, depth first.

AddNode(string, double?)

TreemapChart.cs

Adds a top-level node.

public TreemapNode AddNode(string name, double? value = null)

Parameters

name string
The name, drawn in the node.
value double?
The value of a leaf, or null for a section.

Returns

TreemapNode The node.

Exceptions

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

EnumerateNodes()

TreemapChart.cs

Enumerates the nodes and their descendants, depth first.

public IEnumerable<TreemapNode> EnumerateNodes()

Returns

IEnumerable<TreemapNode> The nodes.