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

legendCallback won't execute #3262

Closed
d4popov opened this issue Sep 6, 2016 · 0 comments
Closed

legendCallback won't execute #3262

d4popov opened this issue Sep 6, 2016 · 0 comments

Comments

@d4popov
Copy link

d4popov commented Sep 6, 2016

I am having trouble with creating a custom legend for my project. I can't seem to be able to override the legendCallback for the chart.

Here is an example with one of the samples: https://jsfiddle.net/2a59cby8/

For now I am doing the simplest thing by trying to turn all the legend rectangles red, but it isnt working.

My ultimate goal and sole purpose of this thing is to actually change the mouse cursor to 'pointer' when the user is hovering over the legend. Currently the Chart.js library has no such functionality as hover over the legend. At its default state the legend has no indication whatsoever that is clickable, so users who are new to this won't realize that straignt away. I am trying to make it as user friendly as possible and a simple cursor change will be enough of a visual cue to help them realize that they can interact with the legend.

Any suggestions?

EDIT:

I figured it out. I was expectingthe chart to automaticaly substitute the default legend with the new one, but it doesnt do that and I found out that I have to call the generateLegend() method by myself. It was confusing because I thought the custom legend functionality is broken. I guess this solves it. It would be nice however if the chart could draw the legend automatically using the overriden legendCallback function instead of hte user having to call generateLegend manually.

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

1 participant