react-highcharts
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "react-highcharts", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "React wrapper for highcharts", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -19,3 +19,2 @@ react-highcharts | ||
```jsx | ||
var React = require('react'); | ||
@@ -28,3 +27,2 @@ var Highcharts = require('react-highcharts'); | ||
React.render(<Highcharts config = {config}></Highcharts>, document.body); | ||
``` | ||
@@ -34,3 +32,18 @@ | ||
Highcharts provides an API for manipulating a chart after the initial render. See the **Methods and Properties** in [the documentation](http://api.highcharts.com/highcharts). Here's how you access it: | ||
```jsx | ||
class MyComponent extends React.Component { | ||
componentDidMount() { | ||
let chart = this.refs.chart.getChart(); | ||
chart.series.addPoint({x: 10, y: 12}); | ||
} | ||
render() { | ||
return <Highcharts config={config} ref="chart"></Highcharts>; | ||
} | ||
} | ||
``` | ||
## Using highcharts-more | ||
Just require `require('react-highcharts/more');` instead of `react-highcharts` |
@@ -22,5 +22,12 @@ global.HighchartsAdapter = require('exports?HighchartsAdapter!Highcharts/js/adapters/standalone-framework.src'); | ||
new Highcharts.Chart(config); | ||
this.chart = new Highcharts.Chart(config); | ||
}, | ||
getChart: function() { | ||
if (!this.chart) { | ||
throw new Error('getChart() should not be called before the component is mounted'); | ||
} | ||
return this.chart; | ||
}, | ||
componentDidMount: function () { | ||
@@ -27,0 +34,0 @@ this.renderChart(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1192983
35808
47