Open corinat opened 6 years ago
@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.
@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.
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.