Hi team.
I want to set padding for each node, but I haven't found any solutions. Thanks for your support.
Hi,
Could you please confirm whether you are expecting a space between the node and connector? If so, we have created a sample as per your requirements. You can set the padding by adjusting the sourcePadding and targetPadding of the connector. If we have misunderstood your requirements, could you please provide us more detailed information such as image to explain your requirement?
Code-snippet:
|
//sets connector default value function connectorDefaults(connector, diagram) { connector.sourcePadding = 25; connector.targetPadding = 25; return connector. } |
Sample:
Regards,
Vivisa
Hi @Vivisa Ganesan, thanks for your reply.
My wish like below image. Set padding from text to node edge.
Hi,
We have created the sample as per your requirement. You can enable the space between the node and annotation by setting the margin property for the annotation. Please refer the below code-snippet and sample
Code-snippet:
|
function nodeDefaults(obj, diagram) { // Sets the annotation for the connector obj.annotations = [ { // Sets the margin for the content margin: { left: 10, right: 10, top: 10, bottom: 10, }, }, ]; } |
Sample:
Regards,
Vivisa
Hi,
You're welcome! Please let us know if you have any further queries on this. We will be happy to assist.
Regards,
Vivisa
Hi @Vivisa Ganesan.
How I can set borderRadius for nodes like above image.
Hi,
We have created the sample as per your requirement. Please note that the "border-radius" property is not applicable to text nodes. Instead, you should use a basic node for border radius and include the content in the "annotations" property and you can set the cornerRadius property in getNodeDefaults method. Please refer to a code example, documentation and sample below.
Sample: 4awq4r (forked) - StackBlitz
Regards,
Vivisa
Many thanks. You helped me a lot.
Hi Hoàng,
You're welcome. Please let us know if you need further assistance. As always, we are happy to help you out.
Regards,
Preethi R