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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Programmatically check and uncheck the legend's checkbox.

Thread ID:





132325 Aug 26,2017 09:21 AM UTC Aug 28,2017 11:12 AM UTC WPF 1
Tags: SfChart
Asked On August 26, 2017 09:21 AM UTC

Is there any way I can set the legends checkbox programmatically? Also I want to know what item in the legend are currently check and uncheck so that when he/she close and open the chart I can save and set the visible series.

Durgadevi Selvaraj [Syncfusion]
Replied On August 28, 2017 08:26 AM UTC

Hi Rex, 

Thanks for contacting Syncfusion Support. 

We have analyzed your query (programmatically check and uncheck legend’s check box and know the current checked and unchecked legend) and achieved it by using IsSeriesVisible property in chart series as shown in the below code, 

<chart:SfChart Margin="10"> 
                <chart:ChartLegend CheckBoxVisibility="Visible"/> 
          <chart:LineSeries ItemsSource="{Binding Collection}"  Label="Series1" XBindingPath="XValue" YBindingPath="YValue"/> 
            <chart:LineSeries ItemsSource="{Binding Collection}" IsSeriesVisible="False" Label="Series2" XBindingPath="XValue" YBindingPath="YValue1"/> 
            <chart:LineSeries ItemsSource="{Binding Collection}" Label="Series3" XBindingPath="XValue" YBindingPath="YValue2"/> 

Please find the output screenshot, 
We have prepared a simple sample for your reference and please downloaded from the below link, 
You can refer our UG Documentation link to know more about Legend in SfChart, 

Durgadevi S 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon