{"name":"echarts-for-react","version":"2.0.1","description":"baidu Echarts(v3.x) components for react","main":"lib/index.js","files":["src","lib"],"scripts":{"start":"webpack-dev-server --watch","lint":"eslint src","clean":"rimraf lib","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","build-demos":"webpack","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":{"babel-cli":"^6.6.0","babel-core":"^6.3.15","babel-eslint":"^7.2.3","babel-jest":"^20.0.3","babel-loader":"^6.2.0","babel-plugin-transform-class-properties":"*","babel-plugin-transform-es3-member-expression-literals":"*","babel-plugin-transform-es3-property-literals":"*","babel-preset-es2015":"^6.24.1","babel-preset-react":"^6.24.1","babel-preset-react-hmre":"^1.1.1","babel-preset-stage-0":"^6.24.1","coveralls":"^2.13.1","cross-env":"^1.0.8","css-loader":"~0.16.0","echarts":"^3.6.1","echarts-liquidfill":"~1.0.5","enzyme":"^2.8.2","eslint":"^3.19.0","eslint-config-airbnb":"^14.1.0","eslint-config-airbnb-base":"^11.1.0","eslint-plugin-babel":"^3.0.0","eslint-plugin-import":"^2.2.0","eslint-plugin-jsx-a11y":"^3.0.2 || ^4.0.0","eslint-plugin-react":"^6.9.0","file-loader":"~0.8.4","immutability-util":"^0.0.1","jest":"^19.0.2","jsx-loader":"~0.13.2","prop-types":"^15.5.7","react":"^15.5.0","react-adsense":"^0.0.2","react-dom":"^15.5.0","react-router":"^2.0.0","react-test-renderer":"^15.5.4","rimraf":"^2.5.0","style-loader":"~0.12.3","webpack":"^1.12.9","webpack-dev-server":"^1.10.1"},"dependencies":{"element-resize-event":"2.0.7"},"peerDependencies":{"react":">=0.13.2 || ^0.14 || ^15.0.0 || >=16.0.0-alpha.1 <17.0.0","prop-types":"^15.5.7","echarts":"^3.0.0"},"jest":{"testRegex":"(/__tests__/.*\\.(test|spec))\\.(ts|tsx|js)$","moduleFileExtensions":["ts","tsx","js","json"],"transform":{"^.+\\.js?$":"babel-jest"},"collectCoverage":true,"collectCoverageFrom":["src/*.{js,jsx}","!**/node_modules/**","!**/vendor/**"]},"gitHead":"aaa41db84dd3ca87318ed2ec4c6e5af81780778d","_id":"echarts-for-react@2.0.1","_npmVersion":"5.4.2","_nodeVersion":"8.7.0","_npmUser":{"name":"atool","email":"i@atool.org"},"dist":{"integrity":"sha512-hzMA7OGtdxHRPVoK/gcRVOGhr0V32BKyx9raJb9XZHtKWd3YvYYI/vRzyXVC4cupNc/R0WMVNRiFx2PtubJBgA==","shasum":"5a3600d3f17b287bcf1318e09d6792510f759bd6","tarball":"http://registry-npm.ywwl.com/echarts-for-react/download/echarts-for-react-2.0.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCX2knEZOXRxzcpgudx0LUqoqElXeNeh1U76CWkOuv9GwIhAOwHKrz5XJcxPnfGgdJ8LaeTXNCwrKNlm0bnJQwj2zyY"}],"size":6301,"noattachment":false,"key":"/echarts-for-react/-/echarts-for-react-2.0.1.tgz"},"maintainers":[{"name":"atool","email":"i@atool.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/echarts-for-react-2.0.1.tgz_1513767990035_0.15852449275553226"},"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":1513767990114,"_cnpm_publish_time":1513767990114,"dist-tags":{"beta":"3.0.4","latest":"3.0.6"}}