Hide Overlapped SeriesEventMarker Labels

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
srinin2k
Posts: 25
Joined: Thu Jun 18, 2015 9:22 pm

Hide Overlapped SeriesEventMarker Labels

Post by srinin2k » Mon Jul 27, 2015 6:46 pm

I'm adding markers to my free point series. These markers have labels and symbols associated with them. The problem is that these labels overlap. How do I make it so that only one of the overlapped labels is visible?

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: Hide Overlapped SeriesEventMarker Labels

Post by ArctionPasi » Wed Jul 29, 2015 4:23 pm

There's no easy way to accomplish that. You can use chart.MeasureText method, pass the marker.Label.Text and marker font as parameters, and you will get the size in pixels of the text. Marker's center as pixels can be resolved with xAxis.ValueToCoord and yAxis.ValueToCoord methods. From these X and Y values you can shift it by marker.Symbol.Width and Height to know the bottom right of it where text start with default settings. Using these coordinates you should be able to make a routine that checks overlapping of the marker texts, and hides the labels if necessary.
LightningChart Support Team, PT

Post Reply