EJ2 Diagram: Set padding for nodeModel

Hello,

I have tried everything to set the padding for a node. I have tried setting similar in getNodeDefaults and in datasourceSettings, doBinding, neither work. I am trying variations of the code below:

```

nodeModel.wrapper = {padding: {bottom: 50, top: 50, left: 50, right: 50}};
```


5 Replies

AR Aravind Ravi Syncfusion Team March 7, 2022 12:18 PM UTC

Hi Mark 

By default, in the diagram, the nodes are gets arranged by using the node's offsetX and offsetY properties. In the diagram, we do not have padding support for the nodes. Could you please share us a pictorial representation or more details of your requirement i.e. what are you trying to achieve using padding for the nodes in the diagram. This would help us to analyze further and provide solution as soon as possible. 

Regards 
Aravind Ravi 



MA Mark March 7, 2022 10:00 PM UTC

Thank you, I am just trying to get consistent padding around the text in the node.  See this issue below:


jira_chart.png



AR Aravind Ravi Syncfusion Team March 8, 2022 12:29 PM UTC

Hi Mark, 
 
As we said earlier, we do not have padding support for the diagram. Instead of use padding we can able to set space between node and text using the annotation’s width and height properties. Set the annotation’s width and height less than node’s width and height so that space get rendered between text and node. Please refer to the below code snippet 
 
{ 
        id: 'node1', width: 100, height: 50, offsetX: 300, offsetY: 100, style: { fill: 'red' }, 
        annotations: [{ content: 'Node 1 annotation', width: 80, height: 40 }] 
    }, 
 
For more information about annotation properties, please refer to below help documentation link 
 
 
Regards 
Aravind Ravi 



MA Mark March 8, 2022 07:02 PM UTC

Thank you.  I was setting minWidth and minHeight, hoping that would mean the nodes dynamically size.  Since that does not occur, I will just figure out a size based on string length.  Thank you again for clarifying the api.



AR Aravind Ravi Syncfusion Team March 9, 2022 10:20 AM UTC

Hi Mark 

Most Welcome. Please let us know whether you need any further assistance on this. 

Regards 
Aravind Ravi 


Loader.
Up arrow icon