Sign in to follow this  
programmer

zoomline chart - when "seriesname" is clicked

Recommended Posts

I am wondering if I can write JavaScript so that when the user clicks on the "seriesname" in a zoomline chart, if I can toggle between displaying certain values.  I know how to write the JavaScript to show and hide elements... I just need to know how to recognize when the user clicks on the "seriesname" to call that function.  Any help or links I may have overlooked is appreciated.

Share this post


Link to post
Share on other sites

Hi,

 

To identify the legend item ("seriesname") in legend you can make use of the legendItemClicked() in your chart. This event is fired when user clicks on individual legend items. By default, the legend items on a chart are configured to toggle the visibility of the dataset (series) that the legend item points to.

 

Please refer the fiddle below for its implementation.

http://jsfiddle.net/moonmi/mf3z433c/

 

Hope this would resolve your issue.

 

Thanks.

Share this post


Link to post
Share on other sites

Thanks so much!  Very helpful and I'm on my way.  How can I tell if the legend item is active or not?  For example, what I am doing is showing extra data when the user clicks on the legend item below the chart.  If the item is active, I will set visibility to "visible" otherwise, I'll set visibility to "hidden".  I can get the toggling working on click, but need to test against the legend item being on or off.

 

Thanks, again!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this