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

Idea of using legends as on/off buttons

Hi,

Here's the  idea, click a legend to turn the referenced chart off ( by changing the isVisible property), click again to turn it on.

I tried it in onLegendTapped and it works.

Though, when a chart is turned off, I hope it's legend change to a customizable color like grey instead of white, and still show it's title, is that possible?


15 Replies 1 reply marked as answer

YG Yuvaraj Gajaraj Syncfusion Team January 25, 2023 02:49 PM UTC

Hi Zhu,


We are validating your query and trying to create a feasible workaround for your requirement, and we need time on this we will update the status in one business day on 27 January 2023. We appreciate your patience until then.


Regards,

Yuvaraj.



ZH Zhu January 26, 2023 11:10 AM UTC

Hi, Yuvaraj,


Great, that sounds good.


Regards,

Zhu



YG Yuvaraj Gajaraj Syncfusion Team January 27, 2023 02:53 PM UTC

Hi Zhu,


Thanks for your patience.


Your requirement can be achieved with the help of the legendItemBuilder property in the legend, which is used to render a custom widget instead of an actual legend. Here we have rendered a custom shape widget with a series color and changed the color of the widget based on the series visibility. We have shared the sample below for your requirement, you can modify the sample as per your requirement.


Screenshot: