How to set padding of node

Hi team. 

I want to set padding for each node, but I haven't found any solutions. Thanks for your support.

 

Image_6772_1698397619478


9 Replies

VG Vivisa Ganesan Syncfusion Team October 30, 2023 09:54 AM UTC

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:

Nkbg6q (forked) - StackBlitz


Regards,

Vivisa



NH Ngoc Hoang October 30, 2023 10:10 AM UTC

Hi @Vivisa Ganesan, thanks for your reply. 

My wish like below image. Set padding from text to node edge

Image_7830_1698660437375



VG Vivisa Ganesan Syncfusion Team October 31, 2023 11:55 AM UTC

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:

Nkbg6q (forked) - StackBlitz



Regards,

Vivisa



NH Ngoc Hoang replied to Vivisa Ganesan November 1, 2023 02:05 AM UTC

Thanks.



VG Vivisa Ganesan Syncfusion Team November 1, 2023 03:36 AM UTC

Hi,

You're welcome! Please let us know if you have any further queries on this. We will be happy to assist.

Regards,

Vivisa





NH Ngoc Hoang November 14, 2023 06:23 AM UTC

Hi @Vivisa Ganesan.

How I can set borderRadius for nodes like above image.



VG Vivisa Ganesan Syncfusion Team November 17, 2023 05:00 AM UTC

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



NH Ngoc Hoang replied to Vivisa Ganesan November 21, 2023 01:54 AM UTC

Many thanks. You helped me a lot.



PR Preethi Rajakandham Syncfusion Team November 21, 2023 04:15 AM UTC

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


Loader.
Up arrow icon