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

How chart default series hidden and legend click series visible

Thread ID:

Created:

Updated:

Platform:

Replies:

126114 Nov 16,2015 08:03 AM UTC Sep 26,2016 07:37 PM UTC Xamarin.Forms 3
loading
Tags: SfChart
jinchul oh
Asked On November 16, 2015 08:03 AM UTC

Hello,

I would like to default series hidden and legend click series visible.

I tried the code below with the visibility which works on the series but legend click series is not visible.

  1.                 function onlegenditemclick(sender) 
  2. {
  3.    for (var i = 0; i < sender.model.series.length; i++) {
  4.        if (sender.model.series[i].name == "Wastage")
  5.            sender.model.series[i].visibility = "visible";
  6.    }
  7. }

  8. function onclientPreRender(sender) {
  9.    for (var i = 0; i < sender.model.series.length; i++) {
  10.        if (sender.model.series[i].name == "Wastage")
  11.            sender.model.series[i].visibility = "hidden";
  12.    }
  13. }

Attachment: column_e5da3463.zip

Sanjith Kesavan [Syncfusion]
Replied On November 17, 2015 06:24 AM UTC

Hi jinchul oh,
Thanks for contacting Syncfusion support. The “preRender” event will trigger whenever the chart is redrawn, the legend click event will redraw the chart so the preRender will trigger again. In your sample we found that you have set the series visibility as "hidden" in the preRender event and in the legendItemClick event you have set the visibility of the series as "visible" and thus the issue. To avoid this please set the series visibility as "hidden" directly while creating a series.

For setting the series visibility as hidden please use the following code example [JS]
name: 'Wastage',
fill: "#34495E",
opacity: 0.7,
visibility: "hidden"
In the above code example we have set the visibility of the series as hidden. So when the chart is rendered particular series is hidden. Please find the below screenshot

If the legend is clicked then the chart is visible. Please find the below screenshot.

We have modified your sample as per you requirement. Please find the sample from below location.
Sample Link: http://www.syncfusion.com/downloads/support/forum/121160/ze/column-970290589

Please let us know if you have any concern.

Thanks,
Sanjith K.

Rajasekaran Mani
Replied On September 23, 2016 10:25 AM UTC

We would like to explore same behavior in Xamarin forms doughnut chart. Please provide your inputs on that.

Yuvaraj Palanisamy [Syncfusion]
Replied On September 26, 2016 07:37 PM UTC

Hi Rajasekaran Mani, 
 
We have prepared a workaround sample as per your requirement. Please find the sample from the below location. 
 
  
Regards, 
Yuvaraj  


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.

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

;