This is a migrated thread and some comments may be shown as answers.

Programmatically trigger legendItemClick event

3 Answers 497 Views
Charts
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 12 Dec 2013, 09:37 PM
Hello-

In release v2013.2.918 we were taking advantage of the chart's legendItemClick default functionality of hiding series on a click event.

We also had some add'l buttons on our page that we tied in to this functionality to programmatically trigger the legendItemClick with a simple:

$('legend-item-element').click()

and the user could click these other (non-Kendo) buttons and show/hide chart series. This worked great - see this fiddle:

http://jsfiddle.net/gtP55/


Since the last release, we can no longer successfully call $('legend-item-element').click(). The click event is not properly triggered programatically. Is there any way to do so? This functionality is heavily enmeshed in our page now and users are expecting it.

Thanks!

James

3 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 13 Dec 2013, 01:53 PM
Hello James,

I am afraid that programmatically showing or hiding series is currently not supported out of the box, thus we cannot guarantee that the workaround you found will work in further releases. I would suggest you to submit a feature request to our feedback portal, so other members of the community can evaluate, comment on and vote for it. Most voted ideas are included in next KendoUI releases. Although I recommend against it, you could use the _legendItemClick method as a workaround, however you should keep in mind that using private methods is generally considered a bad practice. For convenience I prepared this small example, which demonstrates the described functionality.

Regards,
Alexander Popov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
James
Top achievements
Rank 1
answered on 13 Dec 2013, 02:38 PM
Excellent thanks for the response Alexander. We do try to never utilize private methods but _legendItemClick will allow us to gracefully transition in the meantime. I submitted the idea for a public method as suggested.

Have a good day-

James
0
Alex Hajigeorgieva
Telerik team
answered on 14 Apr 2020, 07:19 AM

Hi,

Just a quick note that the Feedback item  James submitted was completed with the addition of the toggleVisibility() method.

Regards,
Alex Hajigeorgieva
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Charts
Asked by
James
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
James
Top achievements
Rank 1
Alex Hajigeorgieva
Telerik team
Share this question
or