NetworkMark<T> Class

Draws a network graph (a node-link diagram) with a row per link: the nodes are placed by the force-directed layout of d3-force, where the links are springs and the nodes repel each other, then the drawing is fitted to the plot area. The layout is deterministic: it runs a fixed number of ticks from fixed starting positions.

public sealed class NetworkMark<T> : Mark<T>

Type parameters

T
The type of the rows: the links.

Remarks

The nodes are the names that the links reference, in the order they appear. NetworkMark<T>.NodeFill colors them with the color scale; Mark<T>.Stroke colors the links.

Inheritance
Mark<T> NetworkMark<T>

Constructors

NameDescription
NetworkMark(IEnumerable<T>, Func<T, object?>, Func<T, object?>)Initializes a new instance of the NetworkMark<T> class.

NetworkMark(IEnumerable<T>, Func<T, object?>, Func<T, object?>)

NetworkMark.cs

Initializes a new instance of the NetworkMark<T> class.

public NetworkMark(IEnumerable<T> data, Func<T, object?> source, Func<T, object?> target)

Parameters

data IEnumerable<T>
The rows: the links.
source Func<T, object?>
The channel of the name of a node of the link.
target Func<T, object?>
The channel of the name of the other node of the link.

Properties

NameDescription
ChargeGets or sets the strength of the force between every pair of nodes: negative values repel, positive values attract. The default is -30, as d3.
IterationsGets or sets the number of ticks of the simulation. The default is 300, as d3: the number of ticks until the simulation cools down.
LinkDistanceGets or sets the length of the springs of the links, before the drawing is fitted to the plot area. The default is 30, as d3.
LinkOpacityGets or sets the opacity of the links, from 0 to 1. The default is 0.6.
NodeFillGets or sets the channel of the fill color of a node, from its name, mapped by the color scale, or null to use Mark<T>.FillColor.
NodeRadiusGets or sets the radius of the nodes. The default is 5.
ShowLabelsGets or sets a value that indicates whether the names of the nodes are drawn on their right. The default is true.
SourceGets the channel of the name of a node of the link.
TargetGets the channel of the name of the other node of the link.

Gets or sets the strength of the force between every pair of nodes: negative values repel, positive values attract. The default is -30, as d3.

public double Charge { get; set; }

Property value

double

Iterations

NetworkMark.cs

Gets or sets the number of ticks of the simulation. The default is 300, as d3: the number of ticks until the simulation cools down.

public int Iterations { get; set; }

Property value

int

Exceptions

ArgumentOutOfRangeException
The value is negative.

LinkDistance

NetworkMark.cs

Gets or sets the length of the springs of the links, before the drawing is fitted to the plot area. The default is 30, as d3.

public double LinkDistance { get; set; }

Property value

double

LinkOpacity

NetworkMark.cs

Gets or sets the opacity of the links, from 0 to 1. The default is 0.6.

public double LinkOpacity { get; set; }

Property value

double

Gets or sets the channel of the fill color of a node, from its name, mapped by the color scale, or null to use Mark<T>.FillColor.

public Func<string, object?>? NodeFill { get; set; }

NodeRadius

NetworkMark.cs

Gets or sets the radius of the nodes. The default is 5.

public double NodeRadius { get; set; }

Property value

double

ShowLabels

NetworkMark.cs

Gets or sets a value that indicates whether the names of the nodes are drawn on their right. The default is true.

public bool ShowLabels { get; set; }

Property value

bool

Gets the channel of the name of a node of the link.

public Func<T, object?> Source { get; }

Property value

Func<T, object?>

Gets the channel of the name of the other node of the link.

public Func<T, object?> Target { get; }

Property value

Func<T, object?>