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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

labeling orthogonal and polyline links

Thread ID:

Created:

Updated:

Platform:

Replies:

96004 Aug 15,2010 02:21 PM UTC Aug 21,2010 08:25 AM UTC WinForms 3
loading
Tags: Diagram
Administrator [Syncfusion]
Asked On August 15, 2010 02:21 PM UTC

How do I position the label for an orthogonal or polyline link so that it sits in the center of one of the line segments (preferable one that is horizontal, if it exists) instead of in the center of the link's bounding box?

Pandi Murugan A [Syncfusion]
Replied On August 20, 2010 01:01 PM UTC

Hi Jan,

Thank you for using Syncfusion Products.

We suggest you to use Syncfusion Diagram Label’s property ‘Position’ to position the label for nodes/connectors in your diagram. By default its value is Center. It has some other values TopLeft, TopRight, TopCenter, BottomLeft, BottomRight, BottomCenter, Custom, MiddleLeft, and MiddleRight.

Please refer the following code snippet.


[C#]
Syncfusion.Windows.Forms.Diagram.Label lbl = new Syncfusion.Windows.Forms.Diagram.Label();
lbl.Container = connector;
lbl.Text = "Connector";
lbl.Position = Position.BottomCenter;
lbl.UpdatePosition = true;
connector.Labels.Add(lbl);


We created a sample for your reference. Please refer the sample below.

Forum_LabelPosition-1395112399.zip

Please let me know if you have any concerns.

Regards,
Pandi Murugan A.

Administrator [Syncfusion]
Replied On August 20, 2010 05:34 PM UTC

I was already familiar with the Position property. What I was trying to ask was: How do I test the link so as to be able to determine which position will be the best position for placing the label. (ie; if the orthogonal link is shaped like an 'L', you might want the label at CenterBottom. If it is shaped like an upside-down 'L', you might want it at the CenterTop.)

Sorry I didn't describe the question more clearly.

v/r
Jan

Pandi Murugan A [Syncfusion]
Replied On August 21, 2010 08:25 AM UTC

Hi Jan,

Thank you for your update.

Orthogonal Connector has HeadEndPoint and TailEndPoint property.We suggest you to use HeadEndPoint's and TailEndPoint's property Location.Y to test the link so as to be able to determine which position will be the best position for placing the label. You have to position the connector’s label after adding the connector to diagram.

Please refer the following code snippet.



[C#]

Ellipse ellipse = new Syncfusion.Windows.Forms.Diagram.Ellipse(10, 100, 110, 70);
Syncfusion.Windows.Forms.Diagram.Rectangle rectangle = new Syncfusion.Windows.Forms.Diagram.Rectangle(300, 10, 50, 80);
OrthogonalConnector connector = new OrthogonalConnector(PointF.Empty, new PointF(0, 10));
connector.HeadDecorator.DecoratorShape = DecoratorShape.Filled45Arrow;
connector.LineStyle.LineColor = Color.Black;
this.diagram1.Model.AppendChild(ellipse);
this.diagram1.Model.AppendChild(rectangle);
ellipse.CentralPort.TryConnect(connector.HeadEndPoint);
rectangle.CentralPort.TryConnect(connector.TailEndPoint);
Syncfusion.Windows.Forms.Diagram.Label lbl = new Syncfusion.Windows.Forms.Diagram.Label();
lbl.Container = connector;
lbl.Text = "Connector";
lbl.UpdatePosition = true;
connector.Labels.Add(lbl);
this.diagram1.Model.AppendChild(connector);
if (connector.HeadEndPoint.Location.Y < connector.TailEndPoint.Location.Y)
lbl.Position = Position.BottomCenter;
else
lbl.Position = Position.TopCenter;



In this code the connector’s Label (lbl) is positioned at TopCenter of connector. After interchanging the Y coordinates of ellipse and rectangle Label will be positioned at BottomCenter.

Please refer the sample below.

Forum_LabelPosition_Modified1793598720.zip

Please let me know if you have any concerns.

Regards,
Pandi Murugan A

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.

Please sign in to access our forum

or the page will be automatically redirected to 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

;