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

On click on a slice of the pie table should show only the value of that slice, not the values for all the slices #122

Open
corinat opened this issue Dec 22, 2017 · 2 comments

Comments

@corinat
Copy link

corinat commented Dec 22, 2017

Hi,

I am trying to understand the structure of the javascript files used to create the pies and managed to actually add my own data.
What I would like to do next is when clicking on a slice is to show only the values for that slice, not for all the pie. Didn't really find a way to select only one slice.
Some tips would be much appreciated.

@sfairgrieve
Copy link
Contributor

@corinat Apologies for the delay - I was on vacation. Currently, there's no out of the box way of doing this, but I don't think it would be too difficult to implement. One approach would be to extend L.PieChartMarker and override the _bindMouseEvents method with your own logic for handling interaction with each pie slice. _bindMouseEvents gets called for each slice of the pie chart marker. There you could handle mouse events like click. _bindMouseEvents currently handles the mouseover and mouseout events for displaying/removing the tooltip that shows the data value for each slice. The existing code should provide an example of how you might handle click events in a similar fashion. You may also be able to override bindPopup after extending L.PieChartMarker and figure out which slice was clicked - need to give that approach some more thought, but I think it might be doable.

@corinat
Copy link
Author

corinat commented Jan 3, 2018

@sfairgrieve, thank you for the advice. Do you think that customizing the file that holds the data that are shown onlick could also work? It is a bit of work, but might a be a solution too, although your advice has more sense.

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

2 participants