{"name":"echarts-for-react","version":"2.0.5","description":"baidu Echarts(v3.x & v4.x) components for react.","main":"lib/index.js","types":"lib/index.d.ts","files":["src","lib"],"scripts":{"start":"webpack-dev-server --watch","lint":"eslint src && eslint __tests__ && eslint demo/src","clean":"rimraf lib/core.js && rimraf lib/index.js","test":"npm run lint && npm run cover","demo":"webpack","dev":"webpack --watch","build":"npm run clean && cross-env NODE_ENV=production babel src -d lib && npm run demo","prepublish":"npm run build","cover":"jest --coverage","coveralls":"cat ./coverage/lcov.info | coveralls"},"repository":{"type":"git","url":"git+https://github.com/hustcc/echarts-for-react.git"},"keywords":["react","component","echarts-react","echarts","react-echarts","chart","charts","graph","react-component"],"author":{"name":"hustcc","url":"http://github.com/hustcc"},"license":"MIT","bugs":{"url":"https://github.com/hustcc/echarts-for-react/issues"},"homepage":"https://github.com/hustcc/echarts-for-react","devDependencies":{"76":"^0.0.4","babel-cli":"^6.26.0","babel-core":"^6.26.0","babel-eslint":"^8.0.3","babel-jest":"^21.2.0","babel-loader":"^7.1.2","babel-plugin-transform-class-properties":"^6.24.1","babel-plugin-transform-decorators-legacy":"^1.3.4","babel-plugin-transform-es3-member-expression-literals":"^6.22.0","babel-plugin-transform-es3-property-literals":"^6.22.0","babel-plugin-transform-export-extensions":"^6.22.0","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-polyfill":"^6.26.0","babel-preset-env":"^1.6.1","babel-preset-react":"^6.24.1","coveralls":"^3.0.0","cross-env":"^5.1.3","css-loader":"^0.28.7","echarts":"^4.0.0","echarts-gl":"^1.0.0-beta.6","enzyme":"^3.2.0","enzyme-adapter-react-15":"^1.0.5","eslint":"^4.13.1","eslint-config-airbnb":"^16.1.0","eslint-config-airbnb-base":"^12.1.0","eslint-plugin-babel":"^4.1.2","eslint-plugin-import":"^2.8.0","eslint-plugin-jsx-a11y":"^6.0.3","eslint-plugin-react":"^7.5.1","file-loader":"^1.1.6","jest":"^21.2.1","jest-canvas-mock":"^0.0.2","jsx-loader":"^0.13.2","react":"^15.5.0","react-adsense":"^0.0.3","react-dom":"^15.5.0","react-router":"^2.0.0","react-test-renderer":"^15.6.2","rimraf":"^2.6.2","style-loader":"^0.19.1","webpack":"^3.10.0","webpack-dev-server":"^2.9.7"},"dependencies":{"element-resize-event":"2.0.9"},"peerDependencies":{"react":">=0.13.2 || ^0.14 || ^15.0.0 || >=16.0.0","prop-types":"^15.5.7","echarts":"^3.0.0 || ^4.0.0"},"jest":{"testRegex":"(/__tests__/.*\\.spec)\\.(js|jsx)$","moduleFileExtensions":["js","jsx","json"],"setupFiles":["./__tests__/setup.js","jest-canvas-mock"],"transform":{"^.+\\.js[x]?$":"babel-jest"},"moduleNameMapper":{},"collectCoverage":true,"collectCoverageFrom":["src/*.{js,jsx}","!**/node_modules/**","!**/vendor/**"]},"gitHead":"70ad2a83a2e12b8d64c491432fa351c4eaecd47d","_id":"echarts-for-react@2.0.5","_npmVersion":"5.4.2","_nodeVersion":"8.7.0","_npmUser":{"name":"atool","email":"i@atool.org"},"dist":{"integrity":"sha512-uIxJP38MENAYlWeL3Zr0QBOO1P4J7nnEvyz13b3F8oo1bRLn5rL4nWrBSqbU657HY9EqYcRcX/CHIrx9kUfMlg==","shasum":"f9faf7fd56f2fd19075f041d70563e210b3f56d1","tarball":"http://registry-npm.ywwl.com/echarts-for-react/download/echarts-for-react-2.0.5.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDEgLn6uQxcCoNPwdcLhuitEsAYbLdl6VEOiuusgDia0AiATjk8BYjW2GAceQu7dmNQbI/W3AqNkctxRQcr3DihP6w=="}],"size":7410,"noattachment":false,"key":"/echarts-for-react/-/echarts-for-react-2.0.5.tgz"},"maintainers":[{"name":"atool","email":"i@atool.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/echarts-for-react-2.0.5.tgz_1516241705132_0.42404241720214486"},"directories":{},"readme":"# echarts-for-react\n\nThe simplest, and the best React wrapper for [Apache ECharts](https://github.com/apache/incubator-echarts). \n\n[![npm](https://img.shields.io/npm/v/echarts-for-react.svg)](https://www.npmjs.com/package/echarts-for-react)\n[![Build Status](https://github.com/hustcc/echarts-for-react/workflows/build/badge.svg?branch=master)](https://github.com/hustcc/echarts-for-react/actions?query=workflow%3Abuild)\n[![Coverage](https://img.shields.io/coveralls/hustcc/echarts-for-react/master.svg)](https://coveralls.io/github/hustcc/echarts-for-react)\n[![NPM downloads](https://img.shields.io/npm/dm/echarts-for-react.svg)](https://www.npmjs.com/package/echarts-for-react)\n[![License](https://img.shields.io/npm/l/echarts-for-react.svg)](https://www.npmjs.com/package/echarts-for-react)\n![ECharts Ver](https://img.shields.io/badge/echarts-%5E3.0.0%20%7C%7C%20%5E4.0.0%20%7C%7C%20%5E5.0.0-blue.svg)\n![React Ver](https://img.shields.io/badge/React-%20%5E15.0.0%20%7C%7C%20%20%5E16.0.0%20%7C%7C%20%20%5E17.0.0-blue.svg)\n\n\n## Install\n\n```bach\n$ npm install --save echarts-for-react\n\n# `echarts` is the peerDependence of `echarts-for-react`, you can install echarts with your own version.\n$ npm install --save echarts\n```\n\nThen use it.\n\n```ts\nimport ReactECharts from 'echarts-for-react';\n\n// render echarts option.\n<ReactECharts option={this.getOption()} />\n```\n\nYou can run website.\n\n```bash\n$ git clone git@github.com:hustcc/echarts-for-react.git\n\n$ npm install\n\n$ npm start\n```\n\nThen open [http://127.0.0.1:8081/](http://127.0.0.1:8081/) in your browser. or see [https://git.hust.cc/echarts-for-react/](https://git.hust.cc/echarts-for-react/) which is deploy on gh-pages.\n\n\n## Usage\n\nCode of a simple demo code showed below. For more example can see: [https://git.hust.cc/echarts-for-react/](https://git.hust.cc/echarts-for-react/)\n\n```ts\nimport React from 'react';\nimport ReactECharts from 'echarts-for-react';  // or var ReactECharts = require('echarts-for-react');\n\n<ReactECharts\n  option={this.getOption()}\n  notMerge={true}\n  lazyUpdate={true}\n  theme={\"theme_name\"}\n  onChartReady={this.onChartReadyCallback}\n  onEvents={EventsDict}\n  opts={}\n/>\n```\n\nImport ECharts.js modules manually to reduce bundle size\n\n**With Echarts.js v5:**\n\n```ts\nimport React from 'react';\n// import the core library.\nimport ReactEChartsCore from 'echarts-for-react/lib/core';\n// Import the echarts core module, which provides the necessary interfaces for using echarts.\nimport * as echarts from 'echarts/core';\n// Import charts, all with Chart suffix\nimport {\n  // LineChart,\n  BarChart,\n  // PieChart,\n  // ScatterChart,\n  // RadarChart,\n  // MapChart,\n  // TreeChart,\n  // TreemapChart,\n  // GraphChart,\n  // GaugeChart,\n  // FunnelChart,\n  // ParallelChart,\n  // SankeyChart,\n  // BoxplotChart,\n  // CandlestickChart,\n  // EffectScatterChart,\n  // LinesChart,\n  // HeatmapChart,\n  // PictorialBarChart,\n  // ThemeRiverChart,\n  // SunburstChart,\n  // CustomChart,\n} from 'echarts/charts';\n// import components, all suffixed with Component\nimport {\n  // GridSimpleComponent,\n  GridComponent,\n  // PolarComponent,\n  // RadarComponent,\n  // GeoComponent,\n  // SingleAxisComponent,\n  // ParallelComponent,\n  // CalendarComponent,\n  // GraphicComponent,\n  // ToolboxComponent,\n  TooltipComponent,\n  // AxisPointerComponent,\n  // BrushComponent,\n  TitleComponent,\n  // TimelineComponent,\n  // MarkPointComponent,\n  // MarkLineComponent,\n  // MarkAreaComponent,\n  // LegendComponent,\n  // LegendScrollComponent,\n  // LegendPlainComponent,\n  // DataZoomComponent,\n  // DataZoomInsideComponent,\n  // DataZoomSliderComponent,\n  // VisualMapComponent,\n  // VisualMapContinuousComponent,\n  // VisualMapPiecewiseComponent,\n  // AriaComponent,\n  // TransformComponent,\n  DatasetComponent,\n} from 'echarts/components';\n// Import renderer, note that introducing the CanvasRenderer or SVGRenderer is a required step\nimport {\n  CanvasRenderer,\n  // SVGRenderer,\n} from 'echarts/renderers';\n\n// Register the required components\necharts.use(\n  [TitleComponent, TooltipComponent, GridComponent, BarChart, CanvasRenderer]\n);\n\n// The usage of ReactEChartsCore are same with above.\n<ReactEChartsCore\n  echarts={echarts}\n  option={this.getOption()}\n  notMerge={true}\n  lazyUpdate={true}\n  theme={\"theme_name\"}\n  onChartReady={this.onChartReadyCallback}\n  onEvents={EventsDict}\n  opts={}\n/>\n```\n\n**With Echarts.js v3 or v4:**\n\n```ts\nimport React from 'react';\n// import the core library.\nimport ReactEChartsCore from 'echarts-for-react/lib/core';\n\n// then import echarts modules those you have used manually.\nimport echarts from 'echarts/lib/echarts';\n// import 'echarts/lib/chart/line';\nimport 'echarts/lib/chart/bar';\n// import 'echarts/lib/chart/pie';\n// import 'echarts/lib/chart/scatter';\n// import 'echarts/lib/chart/radar';\n\n// import 'echarts/lib/chart/map';\n// import 'echarts/lib/chart/treemap';\n// import 'echarts/lib/chart/graph';\n// import 'echarts/lib/chart/gauge';\n// import 'echarts/lib/chart/funnel';\n// import 'echarts/lib/chart/parallel';\n// import 'echarts/lib/chart/sankey';\n// import 'echarts/lib/chart/boxplot';\n// import 'echarts/lib/chart/candlestick';\n// import 'echarts/lib/chart/effectScatter';\n// import 'echarts/lib/chart/lines';\n// import 'echarts/lib/chart/heatmap';\n\n// import 'echarts/lib/component/graphic';\n// import 'echarts/lib/component/grid';\n// import 'echarts/lib/component/legend';\nimport 'echarts/lib/component/tooltip';\n// import 'echarts/lib/component/polar';\n// import 'echarts/lib/component/geo';\n// import 'echarts/lib/component/parallel';\n// import 'echarts/lib/component/singleAxis';\n// import 'echarts/lib/component/brush';\n\nimport 'echarts/lib/component/title';\n\n// import 'echarts/lib/component/dataZoom';\n// import 'echarts/lib/component/visualMap';\n\n// import 'echarts/lib/component/markPoint';\n// import 'echarts/lib/component/markLine';\n// import 'echarts/lib/component/markArea';\n\n// import 'echarts/lib/component/timeline';\n// import 'echarts/lib/component/toolbox';\n\n// import 'zrender/lib/vml/vml';\n\n// The usage of ReactEChartsCore are same with above.\n<ReactEChartsCore\n  echarts={echarts}\n  option={this.getOption()}\n  notMerge={true}\n  lazyUpdate={true}\n  theme={\"theme_name\"}\n  onChartReady={this.onChartReadyCallback}\n  onEvents={EventsDict}\n  opts={}\n/>\n```\n\n## Props of Component\n\n - **`option`** (required, object)\n\nthe echarts option config, can see [https://echarts.apache.org/option.html#title](https://echarts.apache.org/option.html#title).\n\n - **`notMerge`** (optional, object)\n\nwhen `setOption`, not merge the data, default is `false`. See [https://echarts.apache.org/api.html#echartsInstance.setOption](https://echarts.apache.org/api.html#echartsInstance.setOption).\n\n - **`lazyUpdate`** (optional, object)\n\nwhen `setOption`, lazy update the data, default is `false`. See [https://echarts.apache.org/api.html#echartsInstance.setOption](https://echarts.apache.org/api.html#echartsInstance.setOption).\n\n - **`style`** (optional, object)\n\nthe `style` of echarts div. `object`, default is {height: '300px'}.\n\n - **`className`** (optional, string)\n\nthe `class` of echarts div. you can setting the css style of charts by class name.\n\n - **`theme`** (optional, string)\n\nthe `theme` of echarts. `string`, should `registerTheme` before use it (theme object format: [https://github.com/ecomfe/echarts/blob/master/theme/dark.js](https://github.com/ecomfe/echarts/blob/master/theme/dark.js)). e.g.\n\n```ts\n// import echarts\nimport echarts from 'echarts';\n...\n// register theme object\necharts.registerTheme('my_theme', {\n  backgroundColor: '#f4cccc'\n});\n...\n// render the echarts use option `theme`\n<ReactECharts\n  option={this.getOption()}\n  style={{height: '300px', width: '100%'}}\n  className='echarts-for-echarts'\n  theme='my_theme' />\n```\n\n - **`onChartReady`** (optional, function)\n\nwhen the chart is ready, will callback the function with the `echarts object` as it's paramter.\n\n - **`loadingOption`** (optional, object)\n\nthe echarts loading option config, can see [https://echarts.apache.org/api.html#echartsInstance.showLoading](https://echarts.apache.org/api.html#echartsInstance.showLoading).\n\n - **`showLoading`** (optional, bool, default: false)\n\n`bool`, when the chart is rendering, show the loading mask.\n\n - **`onEvents`** (optional, array(string=>function) )\n\nbinding the echarts event, will callback with the `echarts event object`, and `the echart object` as it's paramters. e.g:\n\n```ts\nconst onEvents = {\n  'click': this.onChartClick,\n  'legendselectchanged': this.onChartLegendselectchanged\n}\n...\n<ReactECharts\n  option={this.getOption()}\n  style={{ height: '300px', width: '100%' }}\n  onEvents={onEvents}\n/>\n```\nfor more event key name, see: [https://echarts.apache.org/api.html#events](https://echarts.apache.org/api.html#events)\n\n - **`opts`** (optional, object)\n\nthe `opts` of echarts. `object`, will be used when initial echarts instance by `echarts.init`. Document [here](https://echarts.apache.org/api.html#echarts.init).\n\n```ts\n<ReactECharts\n  option={this.getOption()}\n  style={{ height: '300px' }}\n  opts={{renderer: 'svg'}} // use svg to render the chart.\n/>\n```\n\n\n## Component API & Echarts API\n\nthe Component only has `one API` named `getEchartsInstance`.\n\n - **`getEchartsInstance()`** : get the echarts instance object, then you can use any `API of echarts`.\n\nfor example:\n\n```ts\n// render the echarts component below with rel\n<ReactECharts\n  ref={(e) => { this.echartRef = e; }}\n  option={this.getOption()}\n/>\n\n// then get the `ReactECharts` use this.echarts_react\n\nconst echartInstance = this.echartRef.getEchartsInstance();\n// then you can use any API of echarts.\nconst base64 = echartInstance.getDataURL();\n```\n\n**About API of echarts, can see** [https://echarts.apache.org/api.html#echartsInstance](https://echarts.apache.org/api.html#echartsInstance).\n\nYou can use the API to do:\n\n1. `binding / unbinding` event.\n2. `dynamic charts` with dynamic data.\n3. get the echarts dom / dataURL / base64, save the chart to png.\n4. `release` the charts.\n\n\n## FAQ\n\n### How to render the chart with svg when using echarts 4.x\n\nUse the props `opts` of component with `renderer = 'svg'`. For example:\n\n\n```ts\n<ReactECharts\n  option={this.getOption()}\n  style={{height: '300px'}}\n  opts={{renderer: 'svg'}} // use svg to render the chart.\n/>\n```\n\n### How to resolve Error `Component series.scatter3D not exists. Load it first.`\n\nInstall and import [`echarts-gl`](https://www.npmjs.com/package/echarts-gl) module when you want to create a [GL instance](https://www.echartsjs.com/examples/zh/index.html#chart-type-globe)\n\n```sh\nnpm install --save echarts-gl\n```\n\n```ts\nimport 'echarts-gl'\nimport ReactECharts from \"echarts-for-react\";\n\n<ReactECharts\n  option={GL_OPTION}\n/>\n```\n\n\n## LICENSE\n\nMIT@[hustcc](https://github.com/hustcc).\n","publish_time":1516241705202,"_cnpm_publish_time":1516241705202,"dist-tags":{"beta":"3.0.4","latest":"3.0.6"}}