We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Custom shapes in diagram control

Hi there,

I am trying out the diagram control in Blazor and wanted to ask whether it is possible to customize the complete appearance of a diagram node, and if it is possible: how? :)

For example, imagine I wanted a node to look like this: https://ibb.co/hLSBPvB

Is it possible to achieve this?

Thank you,
Wolfgang

1 Reply

SG Shyam G Syncfusion Team October 29, 2019 11:55 AM UTC

Hi Wolfgang, 
 
Yes, you can use our group node to customize the appearance of a diagram node similar to your shared link. We have created a sample in which we have rendered a group node similar to your shared link. Please refer to a code example and sample below. 
 
Code example: 
@*create diagram*@ 
<EjsDiagram Width="100%" Height="800px"> 
   @*create nodes collection*@ 
        <DiagramNodes> 
            @*create node*@ 
            <DiagramNode Id="nodeA" Height="100" Width="400" OffsetX="500" OffsetY="300"> 
                @*set node style*@ 
                <NodeShapeStyle StrokeWidth="5"></NodeShapeStyle> 
                @*create node annotations*@ 
                <DiagramNodeAnnotations> 
                    @*set annotation content*@ 
                    <DiagramNodeAnnotation Content="Cluster Node B"> 
                        @*change annotation style*@ 
                        <NodeAnnotationStyle Bold="true"></NodeAnnotationStyle> 
                        @*change annotation offset*@ 
                        <NodeAnnotationOffset X="0.5" Y="0.5"></NodeAnnotationOffset> 
                    </DiagramNodeAnnotation> 
                </DiagramNodeAnnotations> 
            </DiagramNode> 
            <DiagramNode Id="nodeB" Height="100" Width="100" OffsetX="350" OffsetY="200"> 
                 . . . 
                  . . . 
            </DiagramNode> 
            <DiagramNode Id="nodeC" Height="100" Width="300" OffsetX="550" OffsetY="200"> 
              . . .  
              . . . 
            </DiagramNode> 
            @*create group node*@ 
            <DiagramNode Id="firstGroup" Children="@firstGroupChildren"> 
            </DiagramNode> 
</DiagramNodes> 
</EjsDiagram> 
 
 
@functions{ 
    @*set children for group node*@ 
    private string[] firstGroupChildren { get; set; } = new string[] { "nodeA", "nodeB", "nodeC" }; 
} 
 
 
 
Note: 
 
In blazor, we can render static diagram with basic interaction such as zooming and panning. We have planned to provide interaction support in the diagram for our volume 4, release which is scheduled to release by the month of December, 2019. 
 
 
Regards, 
Shyam G 


Loader.
Up arrow icon