[]
        
(Showing Draft Content)

Palette and Legend

FlexDiagram includes a built-in legend system that categorizes and visually distinguishes nodes. This system uses the LegendItem property.

How LegendItem Property Works

  1. Automatic Node Coloring

    Nodes that share the same LegendItem value receive the same color, selected sequentially from the diagram’s palette.

  2. Legend Generation

    Each distinct LegendItem value appears as an entry in the diagram legend, making categories easy to understand.

Using Custom Palettes

FlexDiagram provides several built-in palettes. You can also assign custom palettes through the Palette property.

Add LegendItem Example

Assign LegendItem property to group nodes into categories and display them in the diagram legend using the following code:

var node1 = new Node() { Text = "Node 1", LegendItem = "Group 1" };
var node2 = new Node() { Text = "Node 2", LegendItem = "Group 1" };
var node3 = new Node() { Text = "Node 3", LegendItem = "Group 2" };
var node4 = new Node() { Text = "Node 4", LegendItem = "Group 2" };

diagram.Nodes.Add(node1);
diagram.Nodes.Add(node2);
diagram.Nodes.Add(node3);
diagram.Nodes.Add(node4);