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

Add onLeave callback to legend #6059

Merged
merged 9 commits into from
Feb 24, 2019
Merged

Conversation

jonrimmer
Copy link
Contributor

This PR adds an onLeave callback to the legend plugin. This complements the onHover callback, allowing the user to detect when the user has moused away from a formerly hovered legend item.

This helps achieve the use-case of highlighting a particular series on hover as supported by other charting libraries.

It also adds an example page and tests for the legend plugin callbacks.

@benmccann
Copy link
Contributor

@jonrimmer don't worry about the code climate warning, but please do fix the failing test so that Travis succeeds

@jonrimmer
Copy link
Contributor Author

@benmccann Oops, sorry. Should be fixed now.

samples/legend/callbacks.html Outdated Show resolved Hide resolved
@benmccann
Copy link
Contributor

@jonrimmer I like the cleanup! this PR will have to be rebased

src/plugins/plugin.legend.js Outdated Show resolved Hide resolved
src/plugins/plugin.legend.js Outdated Show resolved Hide resolved
samples/legend/callbacks.html Outdated Show resolved Hide resolved
samples/legend/callbacks.html Outdated Show resolved Hide resolved
samples/legend/callbacks.html Outdated Show resolved Hide resolved
samples/legend/callbacks.html Outdated Show resolved Hide resolved
@benmccann
Copy link
Contributor

Looks good to me other than needing to be rebased

@jonrimmer
Copy link
Contributor Author

Rebased

src/plugins/plugin.legend.js Show resolved Hide resolved
@simonbrunel simonbrunel merged commit f3b1837 into chartjs:master Feb 24, 2019
@simonbrunel
Copy link
Member

Thanks @jonrimmer

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

Successfully merging this pull request may close these issues.

6 participants