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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to set the shape in getNodeDefaults

Thread ID:





148956 Nov 8,2019 07:13 PM UTC Nov 11,2019 05:58 AM UTC React - EJ 2 1
Tags: Diagram
raphael chancey
Asked On November 8, 2019 07:13 PM UTC

I am using this code from one of the examples but anything I do to set the shape has no impact..

setting shape obj in fact just breaks things.. 

I was trying set it to a circle.. 

function nodeDefaults(obj, diagram) {
obj.style = {
fill: "#659be5",
strokeColor: "none",
color: "white",
strokeWidth: 2
obj.borderColor = "#3a6eb5";
obj.backgroundColor = "#659be5";
obj.shape.margin = { left: 5, right: 5, bottom: 5, top: 5 };
obj.expandIcon = {
height: 10,
width: 10,
shape: "None",
fill: "lightgray",
offset: { x: 0.5, y: 1 }
obj.expandIcon.verticalAlignment = "Auto";
obj.expandIcon.margin = { left: 0, right: 0, top: 0, bottom: 0 };
obj.collapseIcon.offset = { x: 0.5, y: 1 };
obj.collapseIcon.verticalAlignment = "Auto";
obj.collapseIcon.margin = { left: 0, right: 0, top: 0, bottom: 0 };
obj.collapseIcon.height = 10;
obj.collapseIcon.width = 10;
obj.collapseIcon.padding.top = 5;
obj.collapseIcon.shape = "None";
obj.collapseIcon.fill = "lightgray";
return obj;

Shyam G [Syncfusion]
Replied On November 11, 2019 05:58 AM UTC

Hi Raphael, 

We have created an sample in which we have set a node shape property in getNodeDefaults function and it is working fine at our end. Could you please check in the below sample?. Still, if you face any issues, please share us more details such as modify the below sample. 

Code example: 
<DiagramComponent id="diagram" ref={diagram => (diagramInstance = diagram)} width={"100%"} height={"590px"}   
         getNodeDefaults={(obj, diagram) => { 
            obj.height = 50; 
            //set an shape 
            obj.shape = { 
              type: 'Basic', shape: 'Ellipse' 
            obj.style = { fill: "transparent", strokeWidth: 2 }; 
            return obj; 
              <Inject services={[DataBinding, HierarchicalTree]}/> 

Shyam G 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon