{"name":"echarts-for-react","version":"3.0.0-beta.2","description":" Apache Echarts(v5) components for React.","main":"lib/index.js","module":"esm/index.js","types":"lib/index.d.ts","scripts":{"docs:dev":"NODE_ENV=development dumi dev","docs:build":"NODE_ENV=production dumi build","docs:deploy":"rimraf dist && npm run docs:build && gh-pages -d dist","start":"npm run docs:dev","lint":"eslint src __tests__ && prettier src __tests__ --check","fix":"eslint src __tests__ --fix && prettier src __tests__ --write","clean":"rimraf lib esm dist","test":"jest","lib":"run-p lib:*","lib:cjs":"tsc -p tsconfig.json --target ES5 --module commonjs --outDir lib","lib:esm":"tsc -p tsconfig.json --target ES5 --module ESNext --outDir esm","build":"npm run clean && npm run test && npm run lib"},"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":{"@commitlint/cli":"^11.0.0","@commitlint/config-angular":"^11.0.0","@types/jest":"^26.0.20","@types/node":"^14.14.14","@types/react":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.14.2","@typescript-eslint/parser":"^4.11.0","cross-env":"^5.1.3","dumi":"^1.1.4","dumi-theme-default":"^1.0.4","echarts":"^5.0.2","echarts-gl":"^2.0.1","eslint":"^7.19.0","eslint-config-prettier":"^7.1.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.3.1","gh-pages":"^3.1.0","husky":"^4.3.8","jest":"^26.6.3","jest-canvas-mock":"^2.3.0","jest-electron":"^0.1.11","lint-md-cli":"^0.1.2","lint-staged":"^10.5.3","lodash.clonedeep":"^4.5.0","miz":"^1.0.1","npm-run-all":"^4.1.5","prettier":"^2.2.1","rimraf":"^2.6.2","ts-jest":"^26.5.0","ts-loader":"^8.0.15","typescript":"^4.1.3"},"dependencies":{"size-sensor":"^1.0.0","fast-deep-equal":"^3.1.3"},"peerDependencies":{"react":"^15.0.0 || >=16.0.0","echarts":"^3.0.0 || ^4.0.0 || ^5.0.0"},"jest":{"runner":"jest-electron/runner","testEnvironment":"jest-electron/environment","preset":"ts-jest","collectCoverage":true,"collectCoverageFrom":["src/**/*.ts","!**/node_modules/**","!**/vendor/**"],"testRegex":"/__tests__/.*-spec\\.tsx?$"},"husky":{"hooks":{"pre-commit":"lint-staged","commit-msg":"commitlint -E HUSKY_GIT_PARAMS"}},"lint-staged":{"*.ts":["eslint --fix","prettier --write"],"*.md":["lint-md --fix"]},"gitHead":"2da279172b3e9f0519f407418942f3f5d8de443a","_id":"echarts-for-react@3.0.0-beta.2","_nodeVersion":"12.10.0","_npmVersion":"6.10.3","dist":{"integrity":"sha512-ZBd5KTOoL5HYAUMPLhSeX7U7ibvMj2Bj9THvboEwLbH1Ve5Fcxl/orkC+eFn/tPxcPJYC3+onP/Zw1SQ+AFEIg==","shasum":"dc40e1129341f589072252e111bc5731dc3782c8","tarball":"http://registry-npm.ywwl.com/echarts-for-react/download/echarts-for-react-3.0.0-beta.2.tgz","fileCount":52,"unpackedSize":69370,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgH9tlCRA9TVsSAnZWagAARDAP/A9jxbR7M//PxmZhX1rf\n+fmnIaiHCahJfiljXaRVIIgCiUPPwac0c5xLlr1HdsX0M16HrJVTlmA9WXLf\n13N+dy/PQouA5uNGqQJbmB2zObL4uREceauklmnoCmKkclvAGP0IJwpVyi6U\nHvI5076DZU9RGJYcdAoTnl63aca4f/Y3e/tYjW9OessA/wjhBO7LMJ7Qc39m\nkKCRKYYtdgIefKMKA4s/BOk5HhwX9NyUognKt+y2vxwF23cJimuq9Ksefmt2\nCWMoznj66Yh7lEtpcJQAfOocBFuaxNyS6Fnl1pW8oBdECcJoGMHE2Skp7V1t\n7Eq+vYrIWyo1aVRfb7XB7jI2mcOgm9XPn3kAXnOeiXnswRHnK3i1aqlheEZu\nWb/0dgXhVomM5iiBXKEM/v1kOzYCwwrcG8vJRIVPqt+4jdAEfxIKBuNUyLpy\n/PHlt2XmtIwpxZ4f3K9JF2jtbcRPdqqvqm+OsT0fHFngaGjUZd1CHC+856cy\n8sfJoBOGYdnMgvWm9HJKeF7M7SonHFMEa8KTbu6j1o1BKhVUQ7/kZLfhmiyy\ntTlmYZkq8asa7ZA92Jpgek8781xxqCq2cYJ1L3VC4olZvTNsfpaRgYX0+G2X\ndTdOFPTv9v+9hd5k8shvfNMOxZSUnTDx/CbctRYKqu2phBfQJo6kMF43c1WE\n4adF\r\n=qW+E\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGgA4FG7gB6ScBSDJ8SDseNYc4eCNJHY9KUz+EdrB/NpAiEAicOBpzURtW5mUnk4yVpuZyrB/t6yqdBrmV4GHn2tE+w="}],"size":13700,"noattachment":false,"key":"/echarts-for-react/-/echarts-for-react-3.0.0-beta.2.tgz"},"_npmUser":{"name":"atool","email":"i@hust.cc"},"directories":{},"maintainers":[{"name":"atool","email":"i@hust.cc"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/echarts-for-react_3.0.0-beta.2_1612700517524_0.4304981991661627"},"_hasShrinkwrap":false,"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":1612700517669,"_cnpm_publish_time":1612700517669,"dist-tags":{"beta":"3.0.4","latest":"3.0.6"}}