Nands
Nands

Reputation: 399

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.

Upvotes: 3

Views: 7986

Answers (2)

ppotaczek
ppotaczek

Reputation: 39139

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

Upvotes: 5

Sushil Mahajan
Sushil Mahajan

Reputation: 147

You can build your know component using the Highchart js library. https://www.highcharts.com/demo/pie-basic

Also, have a look at the Highcharts editor - http://editor.highcharts.com/full.html

Upvotes: 0

Related Questions