Highcharts component for react.
- see example of using react-highcharts
- see example of using react-highcharts/more
- see example of using react-highcharts/highstock
- see example of using react-highcharts/highmaps
You can find the full code for the examples here
To run the demo:
- Clone the repo
- run:
npm install npm run demo - Point your browser at http://localhost:8080
If you are using React@0.14 just do this:
npm install react-highcharts --saveFor React@0.13 use:
npm install react-highcharts@^3.0.0 --saveCheck out this recipe
to see how to install Highcharts with npm.
var React = require('react');
var ReactHighcharts = require('react-highcharts'); // Expects that Highcharts was loaded in the code.
var config = {
/* HighchartsConfig */
};
React.render(<ReactHighcharts config = {config}></ReactHighcharts>, document.body);var React = require('react');
var ReactHighcharts = require('react-highcharts/bundle/highcharts'); // Highcharts is bundled
var config = {
/* HighchartsConfig */
};
React.render(<ReactHighcharts config = {config}></ReactHighcharts>, document.body);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:
class MyComponent extends React.Component {
componentDidMount() {
let chart = this.refs.chart.getChart();
chart.series[0].addPoint({x: 10, y: 12});
}
render() {
return <ReactHighcharts config={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.
See this recipe
Require Highmaps first, and then require('react-highcharts/highmaps');
Or use bundled version: require('react-highcharts/bundle/highmaps');
- see the demo
Require Highstock first, and then require('react-highcharts/highstock');
Or use bundled version: require('react-highcharts/bundle/highstock');
- see the demo
Everything related to modules was moved out of react-highcharts.
Now every highcharts module is published as a separate npm package.
You can find the full list list here
- see the demo
-
Install new highcharts version.
npm unistall highcharts-release --save-dev npm install highcharts-release --save-dev -
Increment the
react-highchartsversion such that a patch, minor release, or major release of Higcharts is reflected in a corresponding version increase forreact-highcharts.
Run npm tests