Following the react-chartjs-2 documentation and setting up a Pie chart on codesandbox gets everything working, except the options don't work.
When you set up react-chartjs-2
with import { Pie } from "react-chartjs-2";
, codesandbox will automatically save the latest stable release of react-chartjs-2
and chart.js
as dependencies. This unfortunately breaks things. You need to change the versions in this panel on the left hand side of your codesandbox panels.
I've made a demo, which can be forked to keep all of the dependencies. It also demos a few options that can be adjusted on the chart.