API Reference
VisNetworkLabelBuilder
Provides a fluent API for building HTML-formatted labels for VisNetwork nodes and edges. IMPORTANT: VisJS has limited native HTML support. Only the following tags work natively: - <b> for bold text - <i> for italic text - <code> for monospace text - \n for line breaks (recommended over <br>) Other HTML tags like <u>, <span>, <div>, <small> etc. are NOT supported by VisJS. They will be rendered as plain text. For full HTML support, consider using the visjs-html-nodes plugin (https://github.com/NickvanDyke/visjs-html-nodes).
Inheritance
- Object
- VisNetworkLabelBuilder
Constructors
public VisNetworkLabelBuilder() #Initializes a new instance of the VisNetworkLabelBuilder class.
Methods
public VisNetworkLabelBuilder Bold(String text) #VisNetworkLabelBuilderAdds bold text to the label.
Parameters
- text System.String
- The text to make bold
Returns
The label builder for method chaining
public String Build() #StringBuilds the final HTML label string.
Returns
The HTML-formatted label
public VisNetworkLabelBuilder BulletPoint(String text) #VisNetworkLabelBuilderCreates a simple bulleted list item using supported HTML. Uses "• " prefix since <ul>/<li> are not supported.
Parameters
- text System.String
- The list item text
Returns
The label builder for method chaining
public VisNetworkLabelBuilder Code(String text) #VisNetworkLabelBuilderAdds code/monospace text to the label. This is one of the few HTML tags natively supported by VisJS.
Parameters
- text System.String
- The text to display in monospace font
Returns
The label builder for method chaining
public VisNetworkLabelBuilder Italic(String text) #VisNetworkLabelBuilderAdds italic text to the label.
Parameters
- text System.String
- The text to make italic
Returns
The label builder for method chaining
public VisNetworkLabelBuilder LabelValue(String label, String value) #VisNetworkLabelBuilderCreates a multi-format line with bold label and regular value. Useful for key-value pairs like "Status: Active".
Parameters
- label System.String
- The label text (will be bold)
- value System.String
- The value text
Returns
The label builder for method chaining
public VisNetworkLabelBuilder LineBreak() #VisNetworkLabelBuilderAdds a line break to the label. Uses \n for line breaks as recommended by VisJS documentation.
Returns
The label builder for method chaining
op_Implicit(HtmlForgeX.VisNetworkLabelBuilder builder) #Implicitly converts the builder to a string.
Parameters
- builder HtmlForgeX.VisNetworkLabelBuilder
- The label builder
public VisNetworkLabelBuilder Text(String text) #VisNetworkLabelBuilderAdds plain text to the label.
Parameters
- text System.String
- The text to add
Returns
The label builder for method chaining