react-highcharts
Highcharts 6.x.x component for react. For highcharts 5.x.x use v. 13.0.0
Demos
react-highcharts | react-highcharts/more | react-highcharts/highstock | react-highcharts/highmaps
You can also see Code for the demo and run demo locally
Installation
npm install react-highcharts --save
Usage
Webpack/Browserify
npm install react-highcharts highcharts react --save
const React = ;const ReactDOM = ; const ReactHighcharts = ; // Expects that Highcharts was loaded in the code. const config = /* HighchartsConfig */; ReactDOM;
Optional after-render callback
const afterRender = chart /* do stuff with the chart */ ;<ReactHighcharts = = ></ReactHighcharts>
Passing properties to the wrapping DOM element
<ReactHighcharts = = ></ReactHighcharts>
Accessing Highcharts API After Render
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:
Component { let chart = thisrefschart; chartseries0; } { return <ReactHighcharts = ="chart"></ReactHighcharts>; }
Limiting Highchart Rerenders
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.
Rendering on the server with node
See this recipe
demo)
Using highmaps (const ReactHighmaps = ;
demo)
Using highstock (const ReactHighstock =
demo)
Using highcharts modules/add-ons like exporting, data, etc. (Use highcharts-more
npm package.
const ReactHighcharts = ReactHighchartsHighcharts
You can find the full list here
Passing Highcharts instance manually
const ReactHighcharts =
For Contributors
Running tests
Run npm test
Running demo
git clone https://github.com/kirjs/react-highcharts.gitcd react-highcharts && npm installnpm run demo
Point your browser at http://localhost:8080