Order in which PointLineSeries are displayed

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
Algernon
Posts: 3
Joined: Mon Jan 27, 2020 9:51 am

Order in which PointLineSeries are displayed

Post by Algernon » Mon Jan 27, 2020 10:21 am

Hi,

I am making a chart where several PointLineSeries are displayed. Is there any property that can be used to decide in which order the series are displayed, i.e. which series is displayed in front? For example, in the attached image the gray data is in front of the blue data, how can I switch the order?
graph.png
graph.png (7.25 KiB) Viewed 4013 times
Thank you,
Algernon

Arction_LasseP
Posts: 141
Joined: Wed Mar 27, 2019 1:05 pm

Re: Order in which PointLineSeries are displayed

Post by Arction_LasseP » Mon Jan 27, 2020 12:23 pm

Hello,

There currently isn't a property which controls the order of PointLineSeries. Instead, they are drawn in the order they are added to chart. In other words the first series (chart.ViewXY.PointLineSeries[0]) is always drawn before the second one (chart.ViewXY.PointLineSeries[1]). Therefore, if you want to show the blue data in front of the grey one, add the grey series first and then the blue one.

If you need to change the drawing order while the application is running, it can be done by removing and adding back a series. For example:

Code: Select all

            _chart.BeginUpdate();

            PointLineSeries pls = _chart.ViewXY.PointLineSeries[0]; // Get the first series
            _chart.ViewXY.PointLineSeries.Remove(pls); // Remove the first series from the list
            _chart.ViewXY.PointLineSeries.Add(pls); // Add the same series to the end of the list 

            _chart.EndUpdate();
Hope this helps.
Best regards,
Lasse

Algernon
Posts: 3
Joined: Mon Jan 27, 2020 9:51 am

Re: Order in which PointLineSeries are displayed

Post by Algernon » Mon Jan 27, 2020 2:42 pm

Great, thank you.

Best regards,
Algernon

Post Reply