HtmlForgeX

API Reference

Class

VisNetwork

Namespace HtmlForgeX
Assembly HtmlForgeX
Base Element

VisNetwork component for creating interactive network diagrams

Inheritance

Constructors

public VisNetwork() #

Initializes a new instance of the VisNetwork class.

Methods

AddEdge 5 overloads
public VisNetwork AddEdge(VisNetworkEdgeOptions edgeOptions) #
Returns: VisNetwork

Adds an edge to the network.

Parameters

configure System.Action{HtmlForgeX.VisNetworkEdgeOptions} requiredposition: 0
Action to configure the edge.

Returns

The current VisNetwork instance.

public VisNetwork AddEdge(Object from, Object to, Action<VisNetworkEdgeOptions> configure = null) #
Returns: VisNetwork

Adds an edge connecting two nodes.

Parameters

from System.Object requiredposition: 0
Source node identifier.
to System.Object requiredposition: 1
Target node identifier.
configure System.Action{HtmlForgeX.VisNetworkEdgeOptions} = null optionalposition: 2
Optional action to configure additional edge properties.

Returns

The current VisNetwork instance.

AddEdge(HtmlForgeX.VisNetworkEdge edge) #

Adds a VisNetworkEdge to the diagram (legacy support).

Parameters

edge HtmlForgeX.VisNetworkEdge required
Edge to add.

Returns

The current VisNetwork instance.

AddEdge(HtmlForgeX.VisNetworkEdgeOptions edgeOptions) #

Adds a VisNetworkEdgeOptions to the diagram.

Parameters

edgeOptions HtmlForgeX.VisNetworkEdgeOptions required
Edge options to add.

Returns

The current VisNetwork instance.

public VisNetwork AddEdge(Object edge) #
Returns: VisNetwork

Adds a raw edge object to the diagram (legacy support).

Parameters

edge System.Object requiredposition: 0
Object containing edge definition.

Returns

The current VisNetwork instance.

AddEdges 2 overloads
public VisNetwork AddEdges(IEnumerable<VisNetworkEdgeOptions> edges) #
Returns: VisNetwork

Adds multiple edges to the network.

Parameters

edges HtmlForgeX.VisNetworkEdgeOptions[] requiredposition: 0
Collection of edge configurations.

Returns

The current VisNetwork instance.

AddEdges(System.Collections.Generic.IEnumerable{HtmlForgeX.VisNetworkEdgeOptions} edges) #

Adds multiple edges to the network.

Parameters

edges System.Collections.Generic.IEnumerable{HtmlForgeX.VisNetworkEdgeOptions} required
Collection of edge configurations.

Returns

The current VisNetwork instance.

public VisNetwork AddHtmlNode(VisNetworkHtmlNode node) #
Returns: VisNetwork

Adds a VisNetworkHtmlNode with full HTML support to the diagram. This requires the visjs-html-nodes plugin which will be automatically loaded.

Parameters

node HtmlForgeX.VisNetworkHtmlNode requiredposition: 0
The HTML node to add.

Returns

The current VisNetwork instance.

AddNode 4 overloads
public VisNetwork AddNode(VisNetworkNode node) #
Returns: VisNetwork

Adds a node to the network.

Parameters

configure System.Action{HtmlForgeX.VisNetworkNodeOptions} requiredposition: 0
Action to configure the node.

Returns

The current VisNetwork instance.

public VisNetwork AddNode(Object id, Action<VisNetworkNodeOptions> configure = null) #
Returns: VisNetwork

Adds a node with the specified ID.

Parameters

id System.Object requiredposition: 0
The node identifier.
configure System.Action{HtmlForgeX.VisNetworkNodeOptions} = null optionalposition: 1
Optional action to configure additional node properties.

Returns

The current VisNetwork instance.

AddNode(HtmlForgeX.VisNetworkNode node) #

Adds a strongly typed VisNetworkNode to the diagram (legacy support).

Parameters

node HtmlForgeX.VisNetworkNode required
Node to add.

Returns

The current VisNetwork instance.

public VisNetwork AddNode(Object node) #
Returns: VisNetwork

Adds a raw node object to the diagram (legacy support).

Parameters

node System.Object requiredposition: 0
Object containing node definition.

Returns

The current VisNetwork instance.

AddNodes 2 overloads
public VisNetwork AddNodes(IEnumerable<VisNetworkNodeOptions> nodes) #
Returns: VisNetwork

Adds multiple nodes to the network.

Parameters

nodes HtmlForgeX.VisNetworkNodeOptions[] requiredposition: 0
Collection of node configurations.

Returns

The current VisNetwork instance.

AddNodes(System.Collections.Generic.IEnumerable{HtmlForgeX.VisNetworkNodeOptions} nodes) #

Adds multiple nodes to the network.

Parameters

nodes System.Collections.Generic.IEnumerable{HtmlForgeX.VisNetworkNodeOptions} required
Collection of node configurations.

Returns

The current VisNetwork instance.

public VisNetwork Cluster(Action<VisNetworkClusteringOptions> configure) #
Returns: VisNetwork

Clusters nodes based on custom join condition.

Parameters

configure System.Action{HtmlForgeX.VisNetworkClusteringOptions} requiredposition: 0
Action to configure clustering options.

Returns

The current VisNetwork instance.

public VisNetwork ClusterByConnection(Object nodeId, Action<VisNetworkClusterByConnectionOptions> configure = null) #
Returns: VisNetwork

Clusters a node and all nodes connected to it.

Parameters

nodeId System.Object requiredposition: 0
The node ID to cluster with its connections.
configure System.Action{HtmlForgeX.VisNetworkClusterByConnectionOptions} = null optionalposition: 1
Optional action to configure clustering options.

Returns

The current VisNetwork instance.

public VisNetwork ClusterByGroup(String groupName, Action<VisNetworkClusteringOptions> configure = null) #
Returns: VisNetwork

Clusters nodes by their group property.

Parameters

groupName System.String requiredposition: 0
The group name to cluster.
configure System.Action{HtmlForgeX.VisNetworkClusteringOptions} = null optionalposition: 1
Optional action to configure clustering options.

Returns

The current VisNetwork instance.

public VisNetwork ClusterByHubsize(Int32 hubsize = 3, Action<VisNetworkClusterByHubsizeOptions> configure = null) #
Returns: VisNetwork

Clusters nodes that have equal or more edges than the specified hubsize.

Parameters

hubsize System.Int32 = 3 optionalposition: 0
Minimum number of edges to be considered a hub. Default is 3.
configure System.Action{HtmlForgeX.VisNetworkClusterByHubsizeOptions} = null optionalposition: 1
Optional action to configure clustering options.

Returns

The current VisNetwork instance.

public VisNetwork ClusterOutliers(Action<VisNetworkClusteringOptions> configure = null) #
Returns: VisNetwork

Clusters all nodes with only one edge (outliers).

Parameters

configure System.Action{HtmlForgeX.VisNetworkClusteringOptions} = null optionalposition: 0
Optional action to configure clustering options.

Returns

The current VisNetwork instance.

public VisNetwork DownloadAsJson(String filename = "network-export", Action<VisNetworkExportOptions> configure = null, Nullable<Int32> delay = null) #
Returns: VisNetwork

Downloads the network data as a JSON file.

Parameters

filename System.String = "network-export" optionalposition: 0
The filename for the download (without extension).
configure System.Action{HtmlForgeX.VisNetworkExportOptions} = null optionalposition: 1
Optional action to configure export options.
delay System.Nullable{System.Int32} = null optionalposition: 2
Optional delay in milliseconds before executing.

Returns

The current VisNetwork instance.

public VisNetwork ExecuteMethod(String methodName, Nullable<Int32> delay = null, params Object[] parameters) #
Returns: VisNetwork

Executes a custom JavaScript method on the network.

Parameters

methodName System.String requiredposition: 0
The method name to call.
delay System.Nullable{System.Int32} = null optionalposition: 1
Optional delay in milliseconds before executing the method.
parameters System.Object[] requiredposition: 2
Optional parameters for the method.

Returns

The current VisNetwork instance.

public VisNetwork ExecuteMethodDelayed(String methodName, Int32 delay, params Object[] parameters) #
Returns: VisNetwork

Executes a custom JavaScript method after a delay.

Parameters

methodName System.String requiredposition: 0
The method name to call.
delay System.Int32 requiredposition: 1
Delay in milliseconds.
parameters System.Object[] requiredposition: 2
Optional parameters for the method.

Returns

The current VisNetwork instance.

public VisNetwork Export(Action<VisNetworkExportOptions> configure = null, String callback = null, Nullable<Int32> delay = null) #
Returns: VisNetwork

Exports the current network state to a JSON string.

Parameters

configure System.Action{HtmlForgeX.VisNetworkExportOptions} = null optionalposition: 0
Optional action to configure export options.
callback System.String = null optionalposition: 1
JavaScript callback function to receive the exported data.
delay System.Nullable{System.Int32} = null optionalposition: 2
Optional delay in milliseconds before executing.

Returns

The current VisNetwork instance.

public VisNetwork ExportAsImage(String format = "png", String filename = "network-image", Nullable<Int32> delay = null) #
Returns: VisNetwork

Exports the network as an image.

Parameters

format System.String = "png" optionalposition: 0
The image format (png or jpg).
filename System.String = "network-image" optionalposition: 1
The filename for the download (without extension).
delay System.Nullable{System.Int32} = null optionalposition: 2
Optional delay in milliseconds before executing.

Returns

The current VisNetwork instance.

public VisNetwork ExportPositions(String callback = null, Nullable<Int32> delay = null) #
Returns: VisNetwork

Exports node positions to a JSON object.

Parameters

callback System.String = null optionalposition: 0
JavaScript callback function to receive the positions.
delay System.Nullable{System.Int32} = null optionalposition: 1
Optional delay in milliseconds before executing.

Returns

The current VisNetwork instance.

public VisNetwork Fit(Action<VisNetworkFitOptions> configure = null, Nullable<Int32> delay = null) #
Returns: VisNetwork

Fits the network view to show all nodes or specified nodes.

Parameters

configure System.Action{HtmlForgeX.VisNetworkFitOptions} = null optionalposition: 0
Optional action to configure fit options.
delay System.Nullable{System.Int32} = null optionalposition: 1
Optional delay in milliseconds before executing the fit method.

Returns

The current VisNetwork instance.

public VisNetwork Focus(Object nodeId, Action<VisNetworkFocusOptions> configure = null, Nullable<Int32> delay = null) #
Returns: VisNetwork

Focuses the view on a specific node.

Parameters

nodeId System.Object requiredposition: 0
The node ID to focus on.
configure System.Action{HtmlForgeX.VisNetworkFocusOptions} = null optionalposition: 1
Optional action to configure focus options.
delay System.Nullable{System.Int32} = null optionalposition: 2
Optional delay in milliseconds before executing the focus method.

Returns

The current VisNetwork instance.

public VisNetwork Import(String importDataJson, Boolean clearExisting = true, Nullable<Int32> delay = null) #
Returns: VisNetwork

Imports network data from a JSON object.

Parameters

importDataJson System.String requiredposition: 0
The JSON data to import.
clearExisting System.Boolean = true optionalposition: 1
Whether to clear existing nodes and edges.
delay System.Nullable{System.Int32} = null optionalposition: 2
Optional delay in milliseconds before executing.

Returns

The current VisNetwork instance.

public VisNetwork ImportPositions(String positionsJson, Boolean animate = false, Nullable<Int32> delay = null) #
Returns: VisNetwork

Imports node positions from a JSON object.

Parameters

positionsJson System.String requiredposition: 0
The JSON object containing node positions.
animate System.Boolean = false optionalposition: 1
Whether to animate the position changes.
delay System.Nullable{System.Int32} = null optionalposition: 2
Optional delay in milliseconds before executing.

Returns

The current VisNetwork instance.

public VisNetwork MoveTo(Action<VisNetworkMoveToOptions> configure, Nullable<Int32> delay = null) #
Returns: VisNetwork

Moves the view to a specific position.

Parameters

configure System.Action{HtmlForgeX.VisNetworkMoveToOptions} requiredposition: 0
Action to configure move options.
delay System.Nullable{System.Int32} = null optionalposition: 1
Optional delay in milliseconds before executing the move method.

Returns

The current VisNetwork instance.

OnAddedToDocument() #

Called when the element is added to a Document. Ensures that offline embedding rules are applied to all nodes.

public VisNetwork OpenCluster(Object nodeId, Action<VisNetworkOpenClusterOptions> configure = null) #
Returns: VisNetwork

Opens (releases nodes from) a cluster.

Parameters

nodeId System.Object requiredposition: 0
The cluster node ID to open.
configure System.Action{HtmlForgeX.VisNetworkOpenClusterOptions} = null optionalposition: 1
Optional action to configure opening options.

Returns

The current VisNetwork instance.

ProcessCustomShapes(System.Collections.Generic.List{System.Object} arg1, System.String arg2) #

Processes nodes to handle custom shapes by converting ctxRenderer strings to functions.

Parameters

arg1 System.Collections.Generic.List{System.Object} required
arg2 System.String required
public VisNetwork Redraw(Nullable<Int32> delay = null) #
Returns: VisNetwork

Redraws the network.

Parameters

delay System.Nullable{System.Int32} = null optionalposition: 0

Returns

The current VisNetwork instance.

RegisterLibraries() #

Registers the required libraries for VisNetwork.

public VisNetwork SelectEdges(Object[] edgeIds, Nullable<Int32> delay = null) #
Returns: VisNetwork

Selects edges in the network.

Parameters

edgeIds System.Object[] requiredposition: 0
The edge IDs to select.
delay System.Nullable{System.Int32} = null optionalposition: 1
Optional delay in milliseconds before executing the select method.

Returns

The current VisNetwork instance.

public VisNetwork SelectNodes(Object[] nodeIds, Boolean highlightEdges = true, Nullable<Int32> delay = null) #
Returns: VisNetwork

Selects nodes in the network.

Parameters

nodeIds System.Object[] requiredposition: 0
The node IDs to select.
highlightEdges System.Boolean = true optionalposition: 1
Whether to highlight connected edges.
delay System.Nullable{System.Int32} = null optionalposition: 2
Optional delay in milliseconds before executing the select method.

Returns

The current VisNetwork instance.

public VisNetwork SetSeed(Int32 seed) #
Returns: VisNetwork

Sets the seed for the random layout.

Parameters

seed System.Int32 requiredposition: 0
The random seed value.

Returns

The current VisNetwork instance.

public VisNetwork Settings(Action<VisNetworkSettings> configure) #
Returns: VisNetwork

Settings sub‑builder to group less common toggles and keep the root surface tidy.

Parameters

configure System.Action{HtmlForgeX.VisNetworkSettings} requiredposition: 0
public VisNetwork Stabilize(Nullable<Int32> iterations = null, Nullable<Int32> delay = null) #
Returns: VisNetwork

Stabilizes the network.

Parameters

iterations System.Nullable{System.Int32} = null optionalposition: 0
Optional number of iterations.
delay System.Nullable{System.Int32} = null optionalposition: 1
Optional delay in milliseconds before executing the stabilize method.

Returns

The current VisNetwork instance.

public VisNetwork StartSimulation(Nullable<Int32> delay = null) #
Returns: VisNetwork

Starts the physics simulation.

Parameters

delay System.Nullable{System.Int32} = null optionalposition: 0

Returns

The current VisNetwork instance.

public VisNetwork StopSimulation(Nullable<Int32> delay = null) #
Returns: VisNetwork

Stops the physics simulation.

Parameters

delay System.Nullable{System.Int32} = null optionalposition: 0

Returns

The current VisNetwork instance.

public override String ToString() #
Returns: String

Generates the HTML and JavaScript required to render the diagram.

Returns

HTML string representing the network diagram.

public VisNetwork UnselectAll(Nullable<Int32> delay = null) #
Returns: VisNetwork

Clears all selections.

Parameters

delay System.Nullable{System.Int32} = null optionalposition: 0

Returns

The current VisNetwork instance.

public VisNetwork WithEvents(Action<VisNetworkEvents> configure) #
Returns: VisNetwork

Configures event handlers for the network.

Parameters

configure System.Action{HtmlForgeX.VisNetworkEvents} requiredposition: 0
Action to configure events.

Returns

The current VisNetwork instance.

public VisNetwork WithGroup(String groupName, Action<VisNetworkGroupOptions> configure) #
Returns: VisNetwork

Configures node groups for consistent styling.

Parameters

groupName System.String requiredposition: 0
Name of the group.
configure System.Action{HtmlForgeX.VisNetworkGroupOptions} requiredposition: 1
Action to configure group options.

Returns

The current VisNetwork instance.

public VisNetwork WithHierarchicalLayout(VisNetworkLayoutDirection direction = Ud) #
Returns: VisNetwork

Enables hierarchical layout.

Parameters

direction HtmlForgeX.VisNetworkLayoutDirection = Ud optionalposition: 0
The direction of the hierarchy.

Returns

The current VisNetwork instance.

public VisNetwork WithId(String id) #
Returns: VisNetwork

Sets the unique identifier for the network container.

Parameters

id System.String requiredposition: 0
The identifier to use.

Returns

The current VisNetwork instance.

public VisNetwork WithInteraction(Action<VisNetworkInteractionOptions> configure) #
Returns: VisNetwork

Configures interaction options.

Parameters

configure System.Action{HtmlForgeX.VisNetworkInteractionOptions} requiredposition: 0
Action to configure interaction options.

Returns

The current VisNetwork instance.

public VisNetwork WithLayout(Action<VisNetworkLayoutOptions> configure) #
Returns: VisNetwork

Configures the layout algorithm.

Parameters

configure System.Action{HtmlForgeX.VisNetworkLayoutOptions} requiredposition: 0
Action to configure layout options.

Returns

The current VisNetwork instance.

public VisNetwork WithLoadingBar(Boolean enable = true) #
Returns: VisNetwork

Enables the loading bar display while the network is being rendered.

Parameters

enable System.Boolean = true optionalposition: 0
True to enable the loading bar.

Returns

The current VisNetwork instance.

public VisNetwork WithManipulation(Action<VisNetworkManipulationOptions> configure) #
Returns: VisNetwork

Configures manipulation options.

Parameters

configure System.Action{HtmlForgeX.VisNetworkManipulationOptions} requiredposition: 0
Action to configure manipulation options.

Returns

The current VisNetwork instance.

WithOptions 2 overloads
public VisNetwork WithOptions(Action<VisNetworkOptions> configure) #
Returns: VisNetwork

Configures the network options.

Parameters

configure System.Action{HtmlForgeX.VisNetworkOptions} requiredposition: 0
Action to configure the options.

Returns

The current VisNetwork instance.

public VisNetwork WithOptions(String key, Object value) #
Returns: VisNetwork

Sets a specific option using a key-value pair (for backward compatibility).

Parameters

key System.String requiredposition: 0
The option key (e.g., "nodes", "edges", "physics")
value System.Object requiredposition: 1
The option value

Returns

The current VisNetwork instance for method chaining

WithPhysics 2 overloads
public VisNetwork WithPhysics(Action<VisNetworkPhysicsOptions> configure) #
Returns: VisNetwork

Configures the physics simulation.

Parameters

configure System.Action{HtmlForgeX.VisNetworkPhysicsOptions} requiredposition: 0
Action to configure physics options.

Returns

The current VisNetwork instance.

public VisNetwork WithPhysics(Boolean enabled = true) #
Returns: VisNetwork

Enables or disables physics simulation.

Parameters

enabled System.Boolean = true optionalposition: 0
True to enable physics.

Returns

The current VisNetwork instance.

public VisNetwork WithSize(String width, String height) #
Returns: VisNetwork

Sets the size of the network container.

Parameters

width System.String requiredposition: 0
Width (e.g., "100%", "800px").
height System.String requiredposition: 1
Height (e.g., "600px", "100vh").

Returns

The current VisNetwork instance.

Properties

public String Id { get; set; } #

Gets or sets the unique identifier of the diagram container element.

public Boolean EnableLoadingBar { get; set; } #

Gets or sets a value indicating whether the loading bar should be displayed.

Fields

_lazyInit #

When true, defer initialization until the diagram becomes visible. If null, uses document default.

_disablePhysicsAfterStabilization #

When true, physics is disabled after stabilization completes (improves UX/perf for large graphs).