5 Answers, 1 is accepted
I have a bar chart in the attached image.
Does an event exist so that I can click an item in the legend and get the name of the series for that item? For example, if I were to click "Test" next to the little blue square or the blue square itself, I would want to set a variable to "Test", but I can't find what event needs to be attached from the documentation.
Ok, so I managed to come up with a solution through trial and error, but I feel like this is unintuitive and there should be an easier way to go about doing this.
Thank you for writing.
The legend items are created dynamically for each of the series. The approach you have already found is valid to achieve the desired result. Alternatively, once you add the data to the chart you can access the legend items and then attach the Click event to the marker and title element:
I hope this helps. Please let me know if you have other questions.