react-highcharts
Advanced tools
Comparing version 2.0.0 to 2.1.0
{ | ||
"name": "react-highcharts", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "React wrapper for highcharts", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"test": "webpack && mocha", | ||
"demo": "cd demo && webpack && ../node_modules/.bin/webpack-dev-server --content-base dist/", | ||
"prepublish": "webpack" | ||
"prepublish": "webpack", | ||
"deploy-demo": "./demo/deploy.sh" | ||
}, | ||
@@ -34,3 +35,6 @@ "author": "Kirill Cherkashin", | ||
"highlight.js": "^8.5.0", | ||
"highstock-release": "^2.1.8", | ||
"imports-loader": "^0.6.4", | ||
"jsdom": "^6.3.0", | ||
"mocha": "^2.3.0", | ||
"raw-loader": "^0.5.1", | ||
@@ -37,0 +41,0 @@ "react": "*", |
react-highcharts | ||
================ | ||
[![Build Status](https://travis-ci.org/kirjs/react-highcharts.svg?branch=master)](https://travis-ci.org/kirjs/react-highcharts) | ||
Highcharts component for react. | ||
@@ -8,2 +11,3 @@ | ||
* see [example of using react-highcharts/more](http://kirjs.github.io/react-highcharts/more.html) | ||
* see [example of using react-highcharts/highstock](http://kirjs.github.io/react-highcharts/highstock.html) | ||
@@ -49,3 +53,3 @@ You can find the full code for the examples [here](https://github.com/kirjs/react-highcharts/tree/master/demo) | ||
let chart = this.refs.chart.getChart(); | ||
chart.series.addPoint({x: 10, y: 12}); | ||
chart.series[0].addPoint({x: 10, y: 12}); | ||
} | ||
@@ -64,5 +68,12 @@ | ||
Just require `require('react-highcharts/more');` instead of `react-highcharts` | ||
* see [the demo](http://kirjs.github.io/react-highcharts/more.html) | ||
## Update Highcharts Version (For Contributors) | ||
## Using highstock | ||
Just require `require('react-highcharts/highstock');` instead of `react-highcharts` | ||
* see [the demo](http://kirjs.github.io/react-highcharts/highstock.html) | ||
## For Contributors | ||
### Update Highcharts Version | ||
1. Install new highcharts version. | ||
@@ -76,1 +87,4 @@ ``` | ||
Higcharts is reflected in a corresponding version increase for `react-highcharts`. | ||
#### Running tests | ||
Run `npm tests` |
global.HighchartsAdapter = require('exports?HighchartsAdapter!highcharts-standalone-adapter'); | ||
var Highcharts = require("exports?Highcharts!highcharts"); | ||
var React = require('react'); | ||
module.exports = React.createClass({ | ||
displayName: 'Highcharts', | ||
propTypes: { | ||
config: React.PropTypes.object.isRequired, | ||
isPureConfig: React.PropTypes.bool | ||
}, | ||
renderChart: function (config) { | ||
if (!config) { | ||
throw new Error('Config must be specified for the Highchart component'); | ||
} | ||
let chartConfig = config.chart; | ||
this.chart = new Highcharts.Chart({ | ||
...config, | ||
chart: { | ||
...chartConfig, | ||
renderTo: this.refs.chart.getDOMNode() | ||
} | ||
}); | ||
}, | ||
shouldComponentUpdate(nextProps) { | ||
if (!this.props.isPureConfig || !(this.props.config === nextProps.config)) { | ||
this.renderChart(nextProps.config); | ||
} | ||
return true; | ||
}, | ||
getChart: function () { | ||
if (!this.chart) { | ||
throw new Error('getChart() should not be called before the component is mounted'); | ||
} | ||
return this.chart; | ||
}, | ||
componentDidMount: function () { | ||
this.renderChart(this.props.config); | ||
}, | ||
render: function () { | ||
let props = this.props; | ||
props = { | ||
...props, | ||
ref: 'chart' | ||
}; | ||
return <div {...props} />; | ||
} | ||
}); | ||
module.exports.Highcharts = Highcharts; | ||
var chartFactory = require('./chartsFactory.jsx'); | ||
module.exports = chartFactory(Highcharts, 'Chart'); |
@@ -6,2 +6,3 @@ var path = require('path'); | ||
highcharts: ['./src/Highcharts.jsx'], // Array syntax to workaround https://github.com/webpack/webpack/issues/300 | ||
highstock: ['./src/Highstock.jsx'], // Array syntax to workaround https://github.com/webpack/webpack/issues/300 | ||
more: './src/More.jsx' | ||
@@ -35,2 +36,3 @@ }, | ||
alias: { | ||
"highstock" : "highstock-release/highstock.src.js", | ||
"highcharts" : "highcharts-release/highcharts.src.js", | ||
@@ -37,0 +39,0 @@ "highcharts-more" : "highcharts-release/highcharts-more.src.js", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
1356684
29
40274
1
87
0
15