Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using PieChart from highcharts-react-official

Is there a working example of using PieChart from highcharts-react-official [ https://www.npmjs.com/package/highcharts-react-official ]

There is mention of PieChart tag on the below link, but I couldn't find any working example for it: Setting Highcharts piechart chartDefaults from calling jsx file in React

There is one more working example at below link, but it doesn't use PieChart tag: https://codesandbox.io/s/ovx6kqokqq

Does anyone know of an example for PieChart tag?

Thanks.

like image 265
Nands Avatar asked Dec 14 '25 04:12

Nands


1 Answers

You do not need to use PieChart tag to create a pie chart using highcharts-react-official. The type of chart or series in options is important, but the name of tag is not, so for example you can do it this way:

...

import PieChart from "highcharts-react-official";

const options = {
  chart: {
    type: "pie"
  },
  series: [...]
};

class App extends React.Component {
  ...

  render() {
    return (
      <div>
        <h2>Highcharts</h2>
        <PieChart highcharts={Highcharts} options={options} />
      </div>
    );
  }
}

Live demo: https://codesandbox.io/s/139x5p4qpq

like image 108
ppotaczek Avatar answered Dec 15 '25 17:12

ppotaczek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!