Diagram

DiagramControl

Draw a workflow or process as boxes and labeled arrows in one inline SVG.

Overview

DiagramControl is a Blazor diagram that draws boxes and arrows, such as a receiving workflow, as one inline SVG from nodes and connectors you place. Use it to explain a process or show where a request stands; it offers six shape values (Rectangle and RoundedRectangle draw alike), straight or right-angled connectors with labels and arrowheads, and a click event for details. Users cannot drag or edit it; change the objects in C# and the diagram redraws.

Examples

#A receiving workflow

Click a step, or use Previous step and Next step (they walk the accepted path, then the rejected branch), to read who handles it and how long it takes; the page marks the current step with a thicker outline through its CssClass.

acceptedrejectedTruck checked inPallets unloadedGoods inspectedReceipt postedPut awayStock availableSent back
Truck checked in
Dock office
Typical time
10 minutes
What happens
The driver hands in the delivery note; the office finds the purchase order and assigns one of the six docks.

#Shapes, connectors and links

See every shape value and the connector styles on one canvas, with automatic ports and one connector pinned to the bottom and top. Click Bin tag scanned: the handler sets Handled, so its NavigateUrl is not followed until you switch on Follow links. Hover Bin tag scanned or Shipped for a tooltip; the gray node is disabled.

Bin tag example
yesnoOpens the bin tag example on the Barcodes & QR pageBin tag scannedStadiumQuantity enteredParallelogramChilled item?DiamondCold pack addedRectangle, radius 0✉Packing slipRoundedRectanglePickup times are on the dock schedule✔ShippedEllipseProof of deliveryEnabled = false

No node clicked yet.

Documentation

ParameterTypeDefaultDescription
NodesList<DiagramNode>?nullThe boxes to draw, in list order. Each is placed by its own OffsetX and OffsetY; the control does no layout. Ids are matched case-insensitively.
ConnectorsList<DiagramConnector>?nullLines between nodes, drawn behind them. A connector whose SourceId or TargetId matches no node is skipped.
Widthstring"100%"A number of pixels ("460" or "460px") is the drawing area; the SVG and its frame are that plus the padding on both sides. A percentage or auto sizes the frame and makes the SVG 100% wide. The drawing never scales, and whatever lies past the frame is clipped.
Heightstring"500"As Width, for the height.
CssClassstring?nullAdded to the outer fx-diagram div.
Paddingdouble18Space on every side, in pixels. Node coordinates start inside it, and with a pixel Width or Height it is added to that size.
SizePadPercentdouble10More padding: this percentage of the larger pixel dimension, split between the two sides. Width 460, Height 530 and the default 10 would add 26.5 px a side. Only pixel sizes count; both examples set 0 and use Padding alone.
NodeClickedEventCallback<DiagramNodeClickEventArgs>—Raised when an enabled node is clicked, before its NavigateUrl is followed; set Handled on the arguments to stay on the page. While it is bound, every enabled node gets fx-clickable and a pointer cursor.
An unhandled error has occurred. Reload 🗙

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.