Legend checkbox select/unselect all
Posted: Wed Jul 31, 2019 7:57 pm
Hi, Is there any option to add select all/ Unselect all checkbox in legend.
A place for LightningChart Ultimate related Q&A's.
https://lightningchart.com/forum/
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;
_chart.ViewXY.FreeformPointLineSeries.Add(allSeries);
// Subscribe to the event
_chart.ViewXY.LegendBoxes[0].CheckBoxStateChanged += Legend_CheckBoxStateChanged;
private void Legend_CheckBoxStateChanged(object sender, Arction.Wpf.Charting.Views.CheckBoxStateChangedEventArgs e)
{
_chart.BeginUpdate();
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;
}
}
_chart.EndUpdate();
}