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

How to apply fillcolor to connector label

Thread ID:

Created:

Updated:

Platform:

Replies:

118991 May 1,2015 05:26 PM UTC May 5,2015 12:52 PM UTC ASP.NET Web Forms 3
loading
Tags: Diagram
Jim Jacobs
Asked On May 1, 2015 05:26 PM UTC

Hi,

I thought this would be easy.

I'm trying the following:

diagram.updateLabel(conn.name, conn.labels[0], { fillColor: 'white' });

It would seem that conn.labels[0] is undefined.

What am I doing wrong?

Thanks

Jim

Shyam G [Syncfusion]
Replied On May 4, 2015 01:12 PM UTC

Hi Jim

Thanks for using Syncfusion products.

We are glad to let you know that we have created a simple sample to achieve your requirement and it is available in the below link for download. Please refer the code snippet:

Code snippet:

<ej:diagram id="Diagram1" runat="server" height="1000px" width="1000px">
</ej:diagram>

//creating connectors

Connector connect = new Connector();

connect.Name = "samsa";

//adding labels

Label label = new Label();

label.Text = "ram";
Diagram1.Model.Connectors.Add(connect);

<input type="button" value="updatelabel" onclick="updatelabel()" />

<script type="text/javascript">

function updatelabel() {

var diagram = $("#Diagram1").ejDiagram("instance");

var connector = diagram.model.selectedItems.children[0];

if (connector)

diagram.updateLabel(connector.name,connector.labels[0], {fillColor:"blue"});

}
</script>

Sample:http://www.syncfusion.com/downloads/support/forum/118991/updatelabel839675744.zip

Please let me know if any concerns.

Regards,
Shyam G


Jim Jacobs
Replied On May 4, 2015 01:50 PM UTC

Hi Shyam,

Thanks for the code.
Actually I ended up changing the fillcolor in the OnClientTextChange event handler.
It seems that the label does not exist until you first double-click on the connector to add the text.
Anyway, this approach works for me.

Thanks for confirming that my updateLabel statement was in the correct format.

Jim

Shyam G [Syncfusion]
Replied On May 5, 2015 12:52 PM UTC

Hi Jim

Thanks for your update.

Query
Response
It seems that the label does not exist until you first double-click on the connector to add the text.
Please note that by default there won’t be label added in the elements. Once the editing is completed, if an element has a label then the label will updated or else it will be added to the element. Please note that updateLabel method is applicable only when the element has a label.


Please let me know if any concerns,

Regards,
Shyam G

CONFIRMATION

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.

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

;