react-google-charts
react-google-charts copied to clipboard
How to click on a pie chart and got to a url with react-router.
Hi, I'm a total newbie and I'm having a lot of trouble trying to figure out how to work with react-router inside a chartEvents. I want to be able to click on a slice of pie chart and have it go to a route depending on what slice I click on. I can do it with windows.location.href, but it re-renders the entire page, instead of just the component. This is a class component I'm working in.
Much thanks for your help!
I doubt this is an issue with react-google-charts
but you can define an onClick
on the pie chart and in that onClick
you can do let location = useHistory();location.push("/whereverYouWantToGo")