Highcharts 6.x.x component for react. For highcharts 5.x.x use v. 13.0.0
react-highcharts | react-highcharts/more | react-highcharts/highstock | react-highcharts/highmaps
You can also see Code for the demo and run demo locally
npm install react-highcharts --savenpm install react-highcharts highcharts react --saveconstReact=require('react');constReactDOM=require('react-dom');constReactHighcharts=require('react-highcharts');// Expects that Highcharts was loaded in the code.constconfig={/* HighchartsConfig */};ReactDOM.render(<ReactHighchartsconfig={config}></ReactHighcharts>,document.body);constafterRender=(chart)=>{/* do stuff with the chart */};<ReactHighchartsconfig={config}callback={afterRender}></ReactHighcharts><ReactHighchartsconfig={config}domProps={{id: 'chartId'}}></ReactHighcharts>For access to methods & properties from the Highcharts library you can use ReactHighcharts.Highcharts.
For example, the Highcharts options are available via ReactHighcharts.Highcharts.getOptions().
Highcharts provides an API for manipulating a chart after the initial render. See the Methods and Properties in the documentation. Here's how you access it:
classMyComponentextendsReact.Component{componentDidMount(){letchart=this.refs.chart.getChart();chart.series[0].addPoint({x: 10,y: 12});}render(){return<ReactHighchartsconfig={config}ref="chart"></ReactHighcharts>;}}Rerendering a highcharts graph is expensive. You can pass in a isPureConfig option to the ReactHighcharts component, which will keep the highcharts graph from being updated so long as the provided config is referentially equal to its previous value.
There is also neverReflow property.
See this recipe
Using highmaps (demo)
constReactHighmaps=require('react-highcharts/ReactHighmaps');Using highstock (demo)
constReactHighstock=require('react-highcharts/ReactHighstock')Using highcharts modules/add-ons like exporting, data, etc. (demo)
Use highcharts-more npm package.
constReactHighcharts=require('react-highcharts')require('highcharts-more')(ReactHighcharts.Highcharts)You can find the full list list here
constReactHighcharts=require('react-highcharts').withHighcharts(ReactHighstock)Run npm test
git clone https://github.com/kirjs/react-highcharts.git
cd react-highcharts && npm install
npm run demoPoint your browser at http://localhost:8080