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

Hide Line chart series

Thread ID:

Created:

Updated:

Platform:

Replies:

141690 Dec 27,2018 05:59 PM UTC Dec 31,2018 11:02 AM UTC ASP.NET MVC - EJ 2 1
loading
Tags: Chart
jsu
Asked On December 27, 2018 05:59 PM UTC

Hi Team,

Could you please help me to hide the line series according to the checkbox value(checked or not), also rebind the legend ?
In addition, I need to disable onclick functionalities(visible/invisible)of chart legend.



Thanks in advance

Dharanidharan Dharmasivam [Syncfusion]
Replied On December 31, 2018 11:02 AM UTC

Hi Jsu, 
 
Greetings from Syncfusion. 
 
We have analyzed your query and prepared a sample. Here we have two series with two check boxes. We have toggled the visibility of the series using the check boxes. And based on your requirement we have disabled the user interaction for toggling the visibility of series using legend by specifying false to ToggleVisibility property of LegendSettings. Find the code snippet below. 
 
 
@(Html.EJS().Chart("LineChart") 
    .LegendSettings(ls=>ls.ToggleVisibility(false)).Render() 
) 
 
 function Series1Visibility(args) { 
        var index = 0; 
        ChartRefresh(index, args.checked); 
    } 
     
  function ChartRefresh(seriesIndex, seriesVisibility) { 
        var chartObj = document.getElementById('LineChart').ej2_instances[0]; 
        chartObj.series[seriesIndex].visible = seriesVisibility; 
        chartObj.refresh(); 
    } 
 
 
This can be changed based on your scenario. 
Screenshot:  

 
 
 
 
Thanks, 
Dharani. 


CONFIRMATION

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

;