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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Avoid Labels overlapping

Thread ID:

Created:

Updated:

Platform:

Replies:

128167 Jan 5,2017 08:38 PM UTC Jan 9,2017 10:34 AM UTC WinForms 3
loading
Tags: Diagram
Olivier
Asked On January 5, 2017 08:38 PM UTC

Hi,

I'm trying to build a hierarchical layout based on HierarchicalLayout.sln sample. My problem is that I need to put labels along OrgLineConnector and as those labels are a bit long, they overlaps even if there are some space for them to avoid that (movint right/left or up/down as an example). Is there an option that I missed to force labels to be reorganized automatically in a nicer way  ?

Thanks

Olivier



Naganathan Ganesh Babu [Syncfusion]
Replied On January 6, 2017 07:09 AM UTC

Hi Olivier, 
 
Thanks for contacting Syncfusion support. 
 
Please confirm us whether the reported issue is label overlapped with connector (which is shown in below image)? 
 
 
If yes, we can modify label position using Label’s “Position” property and use “UpdatePosition” property to enable/disable the rendering the label within the node bounds manually. But the diagram doesn’t update the label’s position automatically while applying the layout.  
 
So, please share us the layout Diagram saved files(edd) or screen shot of your diagram layout page which will help us to analyze further and we will validate in our side whether is there any possibilities for providing workaround or not.  
 
Regards, 
 
Naganathan K G 


Olivier
Replied On January 6, 2017 07:28 AM UTC

Hi

Thanks for your answer. Labels are overlapping each other. I'm used to Gis Software where this sort of problem is solved by moving each text up/right/down/left or don't show some to try to avoid their boundigboxes to overlap.

Olivier

Attachment: syncfusion_labels_overlapping_ab6c6321.7z

Naganathan Ganesh Babu [Syncfusion]
Replied On January 9, 2017 10:34 AM UTC

Hi Olivier,
 
We have created a sample to achieve your requirement. We have updated the label position based the connector while updating the layout. Please refer to the below code example.
 
Code example:
 
[C#]
 
private void UpdateLabelPosition(NodeCollection nodeCollection)
{
foreach (Node node in nodeCollection)
{
if (node is ConnectorBase)
{
ConnectorBase cont= node as ConnectorBase;
Syncfusion.Windows.Forms.Diagram.Label label = (node as PathNode).Labels[0];
label.Position = Position.Custom;
float x = cont.HeadEndPoint.Location.X - (label.Size.Width / 2);
float y = cont.HeadEndPoint.Location.Y - (label.Size.Height / 2);
PointF point = node.ConvertToNodeCoordinates(new PointF(x, y));
label.OffsetX = point.X;
}
}
}
 
Sample:
 
Please let us know whether the above given code satisfies your requirement or not?
 
Please note that, the label size is based on the given text. If the given text exceeds the limit it will overlap with any other nearest node's labels. To overcome this situation, we have already logged the feature with "Need to provide a Support to wrap the Text based on the Label's Size"and added it to our feature list which can be tracked through our Features Management System.

FR Link: http://www.syncfusion.com/support/directtrac/features/WF-29091
 
Regards,
 
Naganathan K 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

;