We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How to Check/Unchech a serie in codebehind

Hi,

I would like to programmatically  check or uncheck all the series with a shortcut for instance.  

My user want to quickly hide or show all series. 

I tried the code below with the visibility which works on the series but the check box in the legend is not updated.

checkAll = !checkAll;

 foreach (FastLineSeries cs in this.lineChart.Series)            

 {                      

    cs.Visibility = checkAll ? Visibility.Visible : Visibility.Hidden;  

}

 

I want the same behavior as  click on the check box of the legend.

    


4 Replies

SJ Sumathi Jayaraj Syncfusion Team September 1, 2014 04:28 PM UTC

Hi Rodolphe,

We have analyzed your requirements and we can achieve your requirements by using CustomTemplate for ChartLegend. We have prepared a sample based on your requirements. Please find the sample in the following location.

Please let us know if you have any queries.

Regards,
Sumathi J

Attachment: VisibilityCheck_4e4dda86.zip


SJ Sumathi Jayaraj Syncfusion Team September 2, 2014 12:00 PM UTC

Hi Rodolphe,

We have analyzed your requirements and we would like to inform you that the check box in the legend is updated if we set the IsSeriesVisible instead of Visibility property in chartseries. Please find the sample in the following location.

 

Code Snippet[C#]:

checkAll = !checkAll;

foreach (FastLineSeries cs in this.lineChart.Series)            

{                      

    cs.IsSeriesVisible = checkAll ? true : false ;  

}

 

Please let us know if you have any queries.

 

Regards,

Sumathi J


Attachment: VisibilityCheckSample_1a671f0c.zip


RB Rodolphe Billottet September 3, 2014 11:44 PM UTC

Hi Sumathi,

 

It is exactly what I was looking for.

 

Thanks

Rodolphe



SJ Sumathi Jayaraj Syncfusion Team September 5, 2014 05:15 AM UTC

Hi Rodolphe,

Thanks for the update.

Please let us know whether if you need further assistance from us.

Regards,
Sumathi J

Loader.
Live Chat Icon For mobile
Up arrow icon