Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: How can I trap a click event of a legend and get its details? #383

Open
Mashiane opened this issue May 13, 2022 · 3 comments
Open

Comments

@Mashiane
Copy link

Hi there

I'd like to find out if its possible for one to trap a click event on legends, for example, clicking a Pie slice, getting the slice details selected as I would like to perform other actions depending on what is clicked.

Thank you so much!

@scmmishra
Copy link
Contributor

The legend has a class legend-dataset-label and legend-dataset-value, the best you can do right now is to add event listeners to those once the chart is rendered

@casesolved-co-uk
Copy link

Is this still the best way to capture click events @uhrjun ?
Just in vanilla JS in ERPNext, I don't really want to start using react.

@uhrjun
Copy link
Member

uhrjun commented Mar 19, 2024

Indeed, just capturing click events is the easiest way. Is there any problem with it right now? Does it break?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants