How to create a simple diagram with symbol palette?
To create a simple diagram with a symbol palette, you need to define the properties to render them in the specified area. The SymbolPalette displays a collection of palettes. The palette shows a set of nodes and connectors. It allows you to drag and drop the nodes and connectors into the diagram.
Refer to the following code example for how to create a simple diagram with a symbol palette.
public ActionResult DefaultFunctionalities()
{
// Creates a collection of nodes to be displayed in the diagram
List<DiagramNode> nodes = new List<DiagramNode>();
//…
nodes.Add(new DiagramNode()
{
Id = "NewIdea", OffsetY = 80,
OffsetX = 340,
Height = 60,
Annotations = Node1,
Shape = new { type = "Flow", shape = "Terminator" }
});
//…
// Creates a collection of connectors to be displayed in the diagram
List<DiagramConnector> Connectors = new List<DiagramConnector>();
Connectors.Add(new DiagramConnector() { Id = "connector1", SourceID = "NewIdea", TargetID = "Meeting", });
//…
List<Syncfusion.EJ2.Diagrams.DiagramNode> flowShapes = new List<Syncfusion.EJ2.Diagrams.DiagramNode>();
// Adds a node into the flowShapes collection.
flowShapes.Add(new DiagramNode() { Id = "Terminator", Shape = new { type = "Flow", shape = "Terminator" } });
//…
List<DiagramConnector> SymbolPaletteConnectors = new List<DiagramConnector>();
// Adds a connector into the SymbolPaletteConnectors collection.
SymbolPaletteConnectors.Add(new DiagramConnector()
{
Id = "Link1",
Type = Segments.Orthogonal,
SourcePoint = new DiagramPoint() { X = 0, Y = 0 },
TargetPoint = new DiagramPoint() { X = 40, Y = 40 },
TargetDecorator = new ConnectorTargetDecoratorConnectors() { Shape = DecoratorShapes.Arrow },
Style = new DiagramStrokeStyle() { StrokeWidth = 2 }
});
//…
}
Sample:
https://www.syncfusion.com/downloads/support/directtrac/general/ze/Nodes-1535676228.zip