Closed wiznotwiz closed 3 years ago
I was able to solve this with the following steps:
visible
key with true
values to original datasetonClick
prop to legends
onClick
, send the datum
to a function that sets the visible
key to true
or false
upon user togglevisible
to true
Is your feature request related to a problem? Please describe. Are there any plans to add percentages to pie charts? I can adjust my data to calculate percentages manually based on the total amount, but when setting
toggleSerie
totrue
inlegends
, the percents don't update because the data remains the same.Describe the solution you'd like When the user toggles the legend item on a pie chart, a percent value should update.
Describe alternatives you've considered I've thought about mutating the data based on user click of legend items, but that could cause other issues, since Nivo docs say that
data
must be "Chart data, which should be immutable".If anyone has any ideas for workarounds or examples of how they've done it, I'd love to know!
Thank you for an awesome charting library!