Legend checkbox select/unselect all

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Arction_LasseP

Posts: 3
Joined: Wed Jul 31, 2019 6:44 pm

Legend checkbox select/unselect all

Post by sri » Wed Jul 31, 2019 7:57 pm

Hi, Is there any option to add select all/ Unselect all checkbox in legend.

Posts: 75
Joined: Wed Mar 27, 2019 1:05 pm

Re: Legend checkbox select/unselect all

Post by Arction_LasseP » Thu Aug 01, 2019 6:59 am


Currently there isn't a property that allows this. However, this is still possible to implement via CheckBoxStateChanged -event. First, create a series with no points so it will show up in the LegendBox but not in chart. Then inside the CheckBoxStateChanged -event check if the checkbox of this empty series is clicked. Here is an example:

Code: Select all

// Creating empty series
FreeformPointLineSeries allSeries = new FreeformPointLineSeries(_chart.ViewXY, _chart.ViewXY.XAxes[0], _chart.ViewXY.YAxes[0]);
allSeries.Title.Text = "Select all";
 allSeries.LineStyle.Color = Colors.Black;

// Subscribe to the event
_chart.ViewXY.LegendBoxes[0].CheckBoxStateChanged += Legend_CheckBoxStateChanged;

private void Legend_CheckBoxStateChanged(object sender, Arction.Wpf.Charting.Views.CheckBoxStateChangedEventArgs e)

            var series = e.Series as FreeformPointLineSeries;

            if (series.Title.Text == "Select all") // Check what checkbox was clicked
                foreach (FreeformPointLineSeries fpls in _chart.ViewXY.FreeformPointLineSeries)
                    fpls.Visible = e.IsChecked;

If you have more than one type of series in the chart, you can use for example var pls in _chart.ViewXY.GetAllLineSeries() inside the foreach statement, which gets all line series types.

Hope this helps.
Best regards,