VennDiagram Class

A Venn diagram: sets drawn as overlapping circles, whose areas and overlaps follow their sizes, with labels and texts inside them (Mermaid venn-beta). The circles are laid out as Mermaid does, with the algorithm of venn.js.

public sealed class VennDiagram : Diagram
Inheritance
Diagram VennDiagram

Constructors

NameDescription
VennDiagram()

VennDiagram()

VennDiagram.cs
public VennDiagram()

No documentation is available.

Properties

NameDescription
AreasGets the sets and their overlaps, in the order they are drawn: the circles take the colors of the sets in this order.
HeightGets or sets the height of the drawing, in pixels. The default is 450, as in Mermaid.
SetColorsGets the colors of the sets that replace the ones of the theme, by index from 0 to 7 (Mermaid venn1 to venn8): the n-th set takes the color n modulo 8.
StylesGets the styles of the areas and of the texts, applied in order.
TextColorGets or sets the color of the labels of the overlaps and of the texts, or null for the text color of the theme (Mermaid vennSetTextColor).
TextNodesGets the texts placed inside the areas.
WidthGets or sets the width of the drawing, in pixels. The default is 800, as in Mermaid.

Gets the sets and their overlaps, in the order they are drawn: the circles take the colors of the sets in this order.

public IList<VennArea> Areas { get; }

Property value

IList<VennArea>

Gets or sets the height of the drawing, in pixels. The default is 450, as in Mermaid.

public double Height { get; set; }

Property value

double

Exceptions

ArgumentOutOfRangeException
The value is not a positive finite number.

Gets the colors of the sets that replace the ones of the theme, by index from 0 to 7 (Mermaid venn1 to venn8): the n-th set takes the color n modulo 8.

public IDictionary<int, SceneColor> SetColors { get; }

Gets the styles of the areas and of the texts, applied in order.

public IList<VennStyleRule> Styles { get; }

Property value

IList<VennStyleRule>

Gets or sets the color of the labels of the overlaps and of the texts, or null for the text color of the theme (Mermaid vennSetTextColor).

public SceneColor? TextColor { get; set; }

Property value

SceneColor?

Gets the texts placed inside the areas.

public IList<VennTextNode> TextNodes { get; }

Property value

IList<VennTextNode>

Gets or sets the width of the drawing, in pixels. The default is 800, as in Mermaid.

public double Width { get; set; }

Property value

double

Exceptions

ArgumentOutOfRangeException
The value is not a positive finite number.

Remarks

The texts, the outlines and the padding of the circles grow with the width: they are those of Mermaid at a width of 1600 pixels, scaled.

Methods

NameDescription
AddOverlap(IEnumerable<string>, string?, double?)Adds the overlap of sets (Mermaid union).
AddSet(string, string?, double?)Adds a set.
AddStyle(IEnumerable<string>, VennStyle)Adds a style to an area, or to a text.
AddText(IEnumerable<string>, string, string?)Adds a text inside an area.

AddOverlap(IEnumerable<string>, string?, double?)

VennDiagram.cs

Adds the overlap of sets (Mermaid union).

public VennArea AddOverlap(IEnumerable<string> sets, string? label = null, double? size = null)

Parameters

sets IEnumerable<string>
The identifiers of the sets, at least two.
label string?
The label, or null for none.
size double?
The size, or null for 10 divided by the square of the number of sets.

Returns

VennArea The overlap.

Exceptions

ArgumentException
sets has fewer than two identifiers.

AddSet(string, string?, double?)

VennDiagram.cs

Adds a set.

public VennArea AddSet(string id, string? label = null, double? size = null)

Parameters

id string
The identifier of the set.
label string?
The label, or null to show the identifier.
size double?
The size, or null for 10.

Returns

VennArea The set.

AddStyle(IEnumerable<string>, VennStyle)

VennDiagram.cs

Adds a style to an area, or to a text.

public VennStyleRule AddStyle(IEnumerable<string> targets, VennStyle style)

Parameters

targets IEnumerable<string>
The identifiers of the sets of the area, or the identifier of the text.
style VennStyle
The style.

Returns

VennStyleRule The rule.

AddText(IEnumerable<string>, string, string?)

VennDiagram.cs

Adds a text inside an area.

public VennTextNode AddText(IEnumerable<string> sets, string id, string? label = null)

Parameters

sets IEnumerable<string>
The identifiers of the sets of the area.
id string
The identifier of the text.
label string?
The text shown, or null to show the identifier.

Returns

VennTextNode The text.