Diagram

Description

A flow-chart surface with draggable nodes and auto-routed arrows

Diagram is a pannable dotted canvas holding boxes you connect with Connect(from, to). The arrows are computed and drawn on a background canvas, so they follow the nodes as they are dragged. AutoArrange() positions the nodes from their sizes and how they are connected, which is usually enough for a graph you did not lay out by hand.

Nodes are created with DiagramNode(text) and carry Background, Foreground and Text. Nodes(params) replaces the set, Add / Remove / Clear change it afterwards.

DotSpacing(pixels) sets how dense the background grid is and NoDots() removes it entirely. NotDraggable() pins the nodes where they are, for a diagram meant to be read rather than rearranged.

Sample

A small pipeline

API reference

class

Diagram

public partial class Diagram : IComponent, ISpecialCaseStyling

A flow-chart style diagram surface with draggable nodes, auto-computed arrows drawn on a background canvas, a pannable dotted background and automatic node positioning based on node sizes and connectivity.

Namespace
Tesserae
Implements
IComponent, ISpecialCaseStyling

Constructors

NameDescription
DiagramInitializes a new instance of this class.
Constructor
Diagram
public Diagram()

Initializes a new instance of this class.

Properties

NameDescription
StylingContainerGets the HTMLElement that should receive styling.
PropagateToStackItemParentGets whether styling should propagate to the stack item parent.
Property
Diagram.StylingContainer
public HTMLElement StylingContainer

Gets the HTMLElement that should receive styling.

Property
Diagram.PropagateToStackItemParent
public bool PropagateToStackItemParent

Gets whether styling should propagate to the stack item parent.

Methods

NameDescription
NodesAdds the given nodes to the diagram.
AddAdds a single node to the diagram.
RemoveRemoves a node (and any arrows connected to it) from the diagram.
ClearRemoves all nodes and arrows from the diagram.
ConnectConnects two nodes with an auto-computed arrow, adding them to the diagram if needed.
DotSpacingSets the spacing of the dotted background grid (in pixels).
NoDotsHides the dotted background grid.
NotDraggableDisables panning of the diagram background.
AutoArrangeRe-runs the automatic layout for all nodes (including ones previously dragged or explicitly positioned) and re-centers the view.
RenderRenders the component's root HTML element.
RunAutoArrangeAssigns layers to nodes based on connectivity (longest path from the roots), orders nodes within each layer by the position of their parents, and spaces everything using the measured node sizes.
Method
Diagram.Nodes
public Diagram Nodes(params Node[] nodes)

Adds the given nodes to the diagram.

Method
Diagram.Add
public Diagram Add(Node node)

Adds a single node to the diagram.

Method
Diagram.Remove
public Diagram Remove(Node node)

Removes a node (and any arrows connected to it) from the diagram.

Method
Diagram.Clear
public Diagram Clear()

Removes all nodes and arrows from the diagram.

Method
Diagram.Connect
public Diagram Connect(Node from, Node to)

Connects two nodes with an auto-computed arrow, adding them to the diagram if needed.

Method
Diagram.DotSpacing
public Diagram DotSpacing(int pixels)

Sets the spacing of the dotted background grid (in pixels).

Method
Diagram.NoDots
public Diagram NoDots()

Hides the dotted background grid.

Method
Diagram.NotDraggable
public Diagram NotDraggable()

Disables panning of the diagram background.

Method
Diagram.AutoArrange
public Diagram AutoArrange()

Re-runs the automatic layout for all nodes (including ones previously dragged or explicitly positioned) and re-centers the view.

Method
Diagram.Render
public HTMLElement Render()

Renders the component's root HTML element.

Method
Diagram.RunAutoArrange
private void RunAutoArrange()

Assigns layers to nodes based on connectivity (longest path from the roots), orders nodes within each layer by the position of their parents, and spaces everything using the measured node sizes.

class

Diagram

public partial class Diagram
Namespace
Tesserae

See also

© 2026 Curiosity. All rights reserved.