react-highcharts-v5

2.0.1 • Public • Published

react-highcharts-v5

React.js(v16.x+) component wrap for HighCharts.js(v6.x+)

Installation

$ npm install --save highcharts react-highcharts-v5

Usage

  1. Change webpack config

    For webpack 1.x:

          {
            test: /\.jsx?$/,
            loader: 'babel',
            include: [
    -          path.join(prjRoot, 'src')
    +          path.join(prjRoot, 'src'),
    +          path.join(prjRoot, 'node_modules/react-highcharts-v5/src')
            ],
    -        exclude: /node_modules/
    +        exclude: /node_modules(?![\\/]react-highcharts-v5[\\/]src[\\/])/
          },

    For webpack 2.x+:

          {
            test: /\.jsx?$/,
            loader: 'babel-loader',
    -       include: [resolve('src'), resolve('test')]
    +       include: [resolve('src'), resolve('test'), resolve('node_modules/react-highcharts-v5/src')]
          }
  2. Import HighCharts

    import IHighCharts from 'react-highcharts-v5/src/HighCharts.js';
     
    export default () => {
      const options = {};
     
      return (
        <IHighCharts
          options={options}
        />
      );
    };
  3. Import HighMaps

    import IHighCharts from 'react-highcharts-v5/src/HighMaps.js';
     
    export default () => {
      const options = {};
     
      return (
        <IHighCharts
          options={options}
        />
      );
    };
  4. Import HighStock

    import IHighCharts from 'react-highcharts-v5/src/HighStock.js';
     
    export default () => {
      const options = {};
     
      return (
        <IHighCharts
          options={options}
        />
      );
    };

propTypes

className: PropTypes.string,
style: PropTypes.object,
loading: PropTypes.oneOfType([
    PropTypes.string,
    PropTypes.bool
]),
theme: PropTypes.object,
resizable: PropTypes.bool,
options: PropTypes.object.isRequired,
onLoad: PropTypes.func,
onResize: PropTypes.func

defaultProps

className: 'react-highcharts',
style: {
    width: '100%',
    height: '100%'
},
loading: false,
theme: null,
resizable: false,
onLoad: () => {},
onResize: (w, h) => {}

Demo

react-highcharts-v5-demo

License

MIT

Package Sidebar

Install

npm i react-highcharts-v5

Weekly Downloads

2

Version

2.0.1

License

MIT

Unpacked Size

963 kB

Total Files

23

Last publish

Collaborators

  • xlsdg