Legend Box Entries are overlapping

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Arction_LasseP

mobusek
Posts: 8
Joined: Tue Mar 27, 2018 2:16 pm

Legend Box Entries are overlapping

Post by mobusek » Thu Feb 20, 2020 9:16 pm

I'm currently setting up the Lightning Chart to use Legend Boxes. One problem I've hit is that the LegendBoxXY doesn't seem to handle when a Line Series Title spans more than one line. The attached image shows this problem. Both signals on each Y Axis have titles that span two lines. However you can see that the title of the second signal overlaps the first title, and the legend box in general is not large enough to display the second line of the second title.

For our purposes, we use multiple lines in a title to display contextual information and often times units. If it's important, I also tried manually sizing the legend boxes. This did not fix the overlapping problem. Is there a setting on the LegendBoxXY I overlooked that could resolve this problem?
Attachments
ClippedLegendBoxEntries.PNG
ClippedLegendBoxEntries.PNG (28.79 KiB) Viewed 2045 times

ArctionKestutis
Posts: 383
Joined: Mon Mar 14, 2016 9:22 am

Re: Legend Box Entries are overlapping

Post by ArctionKestutis » Mon Feb 24, 2020 1:49 pm

Hello,

Multiline series title in LegendBox currently is not supported. Therefore, you see this overlap as only one line is allocate per series.
Annotation text is more flexible in such formatting (i.e. multiline text is supported there). Unfortunately, only one color per annotation is allowed.
Series.Title.Text itself could be multiline, but to arrange next to other Title maybe tricky. For example, it possible to use Series.Title.DrawRectagle and Series.Title.Offset properties to achieve desired effect.

All the best.

mobusek
Posts: 8
Joined: Tue Mar 27, 2018 2:16 pm

Re: Legend Box Entries are overlapping

Post by mobusek » Tue Feb 25, 2020 9:16 pm

Thank you for the reply. Could multi-line titles in legend boxes be considered for a future version?

The chart supports showing multiple lines of different colors in the same AxisY. But the only way to have titles for each line without covering up the data seems to be Legend Boxes. Annotations seem to be tied to specific data points, not a screen position. So zooming and panning gets complicated. And I can look into manually positioning series titles, but the Legend Box does almost everything we need - it nicely positions titles without covering up the data. You can hover over a legend box entry and highlight the associated signal. The title text and color all match up automatically. The only issue is having multiple lines in the title, so it'd be very convenient for us if that was supported.

Thank you for taking a look at this.

- Michael

ArctionKestutis
Posts: 383
Joined: Mon Mar 14, 2016 9:22 am

Re: Legend Box Entries are overlapping

Post by ArctionKestutis » Wed Feb 26, 2020 3:56 pm

Hi,

Yes, I understand your needs and your point. Unfortunately LegendBox wasn't designed for that. I will include it into requested features list.

Annotation could be tied to Axis value as well as to screen coordinates. For example,

Code: Select all

            annot.LocationCoordinateSystem = CoordinateSystem.ScreenCoordinates;
Annotation's Target could be tied independently. In addition, you could use Annotation.Sizing property to specify specific range of Axis value or coordinates to draw object (with AxisValuesBoundaries or SizeScreenCoords properties respectively).
Don't forget to allow annotation drawing on margins with Annotation.ClipInsideGraph = false.

Another alternative is to use multiple LegendBoxes (in XY only). However, to avoid overlap, you would need to do some calculation anyway. After Chart (LegendBox) is rendered you could read location with

Code: Select all

	chart.ViewXY.LegendBoxes[i].GetRenderedRect()
and modify Offset property.

Hope this helps.