{"name":"echarts-for-react","version":"3.0.2","description":" Apache Echarts 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":"^12.0.0","@commitlint/config-angular":"^12.0.0","@types/jest":"^26.0.20","@types/node":"^14.14.31","@types/react":"^17.0.2","@typescript-eslint/eslint-plugin":"^4.15.2","@typescript-eslint/parser":"^4.15.2","cross-env":"^7.0.3","dumi":"^1.1.6","dumi-theme-default":"^1.0.6","echarts":"^5.0.2","echarts-gl":"^2.0.2","eslint":"^7.20.0","eslint-config-prettier":"^8.1.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.3.1","gh-pages":"^3.1.0","husky":"^5.1.1","jest":"^26.6.3","jest-canvas-mock":"^2.3.1","jest-electron":"^0.1.11","lint-md-cli":"^0.1.2","lint-staged":"^10.5.4","lodash.clonedeep":"^4.5.0","miz":"^1.0.1","npm-run-all":"^4.1.5","prettier":"^2.2.1","rimraf":"^3.0.2","ts-jest":"^26.5.2","ts-loader":"^8.0.17","typescript":"^4.2.2"},"dependencies":{"size-sensor":"^1.0.1","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":"7fc5c33c0b1108c900b8766e208e8d8a2f977f44","_id":"echarts-for-react@3.0.2","_nodeVersion":"14.17.4","_npmVersion":"8.0.0","dist":{"integrity":"sha512-DRwIiTzx8JfwPOVgGttDytBqdp5VzCSyMRIxubgU/g2n9y3VLUmF2FK7Icmg/sNVkv4+rktmrLN9w22U2yy3fA==","shasum":"ac5859157048a1066d4553e34b328abb24f2b7c1","tarball":"http://registry-npm.ywwl.com/echarts-for-react/download/echarts-for-react-3.0.2.tgz","fileCount":52,"unpackedSize":74621,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2pMACRA9TVsSAnZWagAACIMP/00NYkPqleWn8K56LZ/G\nw2Wdd4wp2t/uEfB0QkxBa+m4O1Re5k8jMyjesHzu3O/umjk1wzyjUlN4jWZ8\nZXI6c48ASePqPN6kFr2C1SDRH1uzJsUe5f1tSLM9ixuPO7p4HMuXDYz11EBf\nwf9q46UAvuAZCUwRC1Mk7jJ+moLjymvVZhnj6RWtYCDbp5hFzukybzGf02U5\nOClhF9hiK8TMyTTrRWojeaqfgmHGit3V0am1mdlse9MBreMe82PeDy59PU9x\nqtY8Qu6vcU6p1mSfFzVglo+vEGGMZ6gef4VGstr2EnojKMtj7P9XCwk6sb9T\nZDdRs4/gsxb1no+qAtoXFB3+ge/sAUcTga3D2ahTty8ykSOAbBgcDf0fY1Yo\nG2BlWjMojQ6PAuVtXjLZOGWfPmy58Y273Y1xR5sMGYmG9vIOg+qQuSxDnHkD\nDEWp3Eludo0TrVBsj7dB8yf3l7oiCZacF/tZLW6e0NC5pOyJ/v1nV4K9dWDo\nW8tNZXcDZLZpERJce78I9xlmzfPdx/rUvzOV1/k5ki9/seP9OVt1QdK8r1oV\n+OgTpFzwKgoovVvU3rA1Ay6BNi8ZPlK8ZLpDIAo2f+cyqwd2piLbkJFq62Gt\nzcrDKFeXBkAKRpIexkU0mu23f9MIrDnL4dC23XfjbdhWjz+ONfzn+ovGSlUB\n6p+o\r\n=Kk11\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC2kt/BNh4e/YdQ9zEGxrnne3hwweMEMWDJIF8uPFcocAIgaUPUsgTNktDhlwb68/de7NVKuhkjlnXNM9pA+FIlSkg="}],"size":14966,"noattachment":false,"key":"/echarts-for-react/-/echarts-for-react-3.0.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.2_1635478903614_0.12669231050747976"},"_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":1635478903730,"_cnpm_publish_time":1635478903730,"dist-tags":{"beta":"3.0.4","latest":"3.0.6"}}