echarts-for-react 1.2.5 → 1.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  A very simple echarts(v3.0) wrapper for react.
4
4
 
5
- [![Build Status](https://travis-ci.org/hustcc/echarts-for-react.svg?branch=master)](https://travis-ci.org/hustcc/echarts-for-react) [![npm](https://img.shields.io/npm/v/echarts-for-react.svg?style=flat-square)](https://www.npmjs.com/package/echarts-for-react) [![npm](https://img.shields.io/npm/dt/echarts-for-react.svg?style=flat-square)](https://www.npmjs.com/package/echarts-for-react) [![npm](https://img.shields.io/npm/l/echarts-for-react.svg?style=flat-square)](https://www.npmjs.com/package/echarts-for-react) [![react supported](https://img.shields.io/badge/React-%3E%3D0.13.2%20%7C%7C%20%5E0.14.0%20%7C%7C%20%5E15.0.0-blue.svg?style=flat-square)](https://github.com/hustcc/echarts-for-react)
5
+ [![Build Status](https://travis-ci.org/hustcc/echarts-for-react.svg?branch=master)](https://travis-ci.org/hustcc/echarts-for-react) [![npm](https://img.shields.io/npm/v/echarts-for-react.svg)](https://www.npmjs.com/package/echarts-for-react) [![npm](https://img.shields.io/npm/dt/echarts-for-react.svg)](https://www.npmjs.com/package/echarts-for-react) [![npm](https://img.shields.io/npm/l/echarts-for-react.svg)](https://www.npmjs.com/package/echarts-for-react) [![react supported](https://img.shields.io/badge/React-%3E%3D0.13.2%20%7C%7C%20%5E0.14.0%20%7C%7C%20%5E15.0.0-blue.svg)](https://github.com/hustcc/echarts-for-react)
6
6
 
7
7
  # 1. install
8
8
 
9
9
  ```sh
10
- npm install echarts-for-react
10
+ npm install --save echarts-for-react
11
11
  ```
12
12
 
13
13
  How to run the demo:
@@ -25,19 +25,42 @@ then open [http://127.0.0.1:8080/](http://127.0.0.1:8080/) in your browser. or s
25
25
 
26
26
  # 2. usage
27
27
 
28
- Simple demo code. for more example can see: [http://git.hust.cc/echarts-for-react/](http://git.hust.cc/echarts-for-react/)
28
+ Code of a simple demo code showed below. For more example can see: [http://git.hust.cc/echarts-for-react/](http://git.hust.cc/echarts-for-react/)
29
29
 
30
30
  ```js
31
31
  import React from 'react';
32
32
  import ReactEcharts from 'echarts-for-react'; // or var ReactEcharts = require('echarts-for-react');
33
33
 
34
34
  <ReactEcharts
35
- option={this.getOption()}
36
- notMerge={true}
37
- lazyUpdate={true}
38
- theme={"theme_name"}
39
- onChartReady={this.onChartReadyCallback}
40
- onEvents={EventsDict} />
35
+ option={this.getOption()}
36
+ notMerge={true}
37
+ lazyUpdate={true}
38
+ theme={"theme_name"}
39
+ onChartReady={this.onChartReadyCallback}
40
+ onEvents={EventsDict} />
41
+ ```
42
+
43
+ If you have only used bar chart (or others), you can import echarts modules manually to reduce bundle file size, e.g.
44
+
45
+
46
+ ```js
47
+ import React from 'react';
48
+ // import the core library.
49
+ import ReactEchartsCore from 'echarts-for-react/lib/core';
50
+ // then import echarts modules those you have used manually.
51
+ import echarts from 'echarts/lib/echarts';
52
+ import 'echarts/lib/chart/bar';
53
+ import 'echarts/lib/component/tooltip';
54
+
55
+ // The usage of ReactEchartsCore are same with above.
56
+ <ReactEchartsCore
57
+ echarts={echarts}
58
+ option={this.getOption()}
59
+ notMerge={true}
60
+ lazyUpdate={true}
61
+ theme={"theme_name"}
62
+ onChartReady={this.onChartReadyCallback}
63
+ onEvents={EventsDict} />
41
64
  ```
42
65
 
43
66
 
@@ -70,7 +93,7 @@ the `theme` of echarts. `string`, should `registerTheme` before use it (theme ob
70
93
 
71
94
  ```js
72
95
  // import echarts
73
- import echarts from 'echarts';
96
+ import echarts from 'echarts';
74
97
  ...
75
98
  // register theme object
76
99
  echarts.registerTheme('my_theme', {
@@ -78,12 +101,11 @@ echarts.registerTheme('my_theme', {
78
101
  });
79
102
  ...
80
103
  // render the echarts use option `theme`
81
- <ReactEcharts
82
- option={this.getOption()}
83
- style={{height: '300px', width: '100%'}}
84
- className='echarts-for-echarts'
85
- theme='my_theme' />
86
-
104
+ <ReactEcharts
105
+ option={this.getOption()}
106
+ style={{height: '300px', width: '100%'}}
107
+ className='echarts-for-echarts'
108
+ theme='my_theme' />
87
109
  ```
88
110
 
89
111
  - **`onChartReady`** (optional, function)
@@ -100,18 +122,18 @@ the echarts loading option config, can see [http://echarts.baidu.com/api.html#ec
100
122
 
101
123
  - **`onEvents`** (optional, array(string=>function) )
102
124
 
103
- binding the echarts event, will callback with the `echarts event object`, and `the echart object` as it's paramters. e.g:
125
+ binding the echarts event, will callback with the `echarts event object`, and `the echart object` as it's paramters. e.g:
104
126
 
105
127
  ```js
106
128
  let onEvents = {
107
- 'click': this.onChartClick,
108
- 'legendselectchanged': this.onChartLegendselectchanged
129
+ 'click': this.onChartClick,
130
+ 'legendselectchanged': this.onChartLegendselectchanged
109
131
  }
110
132
  ...
111
133
  <ReactEcharts
112
- option={this.getOption()}
113
- style={{height: '300px', width: '100%'}}
114
- onEvents={onEvents} />
134
+ option={this.getOption()}
135
+ style={{height: '300px', width: '100%'}}
136
+ onEvents={onEvents} />
115
137
  ```
116
138
  for more event key name, see: [http://echarts.baidu.com/api.html#events](http://echarts.baidu.com/api.html#events)
117
139
 
@@ -126,19 +148,19 @@ for example:
126
148
 
127
149
  ```js
128
150
  // render the echarts component below with rel
129
- <ReactEcharts ref='echarts_react'
130
- option={this.getOption()} />
151
+ <ReactEcharts ref={(e) => { this.echarts_react = e; }}
152
+ option={this.getOption()} />
131
153
 
132
- // then get the `ReactEcharts` use this.refs.echarts_react
154
+ // then get the `ReactEcharts` use this.echarts_react
133
155
 
134
- let echarts_instance = this.refs.echarts_react.getEchartsInstance();
156
+ let echarts_instance = this.echarts_react.getEchartsInstance();
135
157
  // then you can use any API of echarts.
136
158
  let base64 = echarts_instance.getDataURL();
137
159
  ```
138
160
 
139
161
  **About API of echarts, can see** [http://echarts.baidu.com/api.html#echartsInstance](http://echarts.baidu.com/api.html#echartsInstance).
140
162
 
141
- you can use the API to do:
163
+ You can use the API to do:
142
164
 
143
165
  1. `binding / unbinding` event.
144
166
  2. `dynamic charts` with dynamic data.
@@ -148,4 +170,6 @@ you can use the API to do:
148
170
 
149
171
  # 5. LICENSE
150
172
 
151
- MIT
173
+ MIT@[hustcc](https://github.com/hustcc).
174
+
175
+
@@ -6,18 +6,14 @@ Object.defineProperty(exports, "__esModule", {
6
6
 
7
7
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
8
8
 
9
- var _echarts = require('echarts');
9
+ var _react = require('react');
10
10
 
11
- var _echarts2 = _interopRequireDefault(_echarts);
11
+ var _react2 = _interopRequireDefault(_react);
12
12
 
13
13
  var _propTypes = require('prop-types');
14
14
 
15
15
  var _propTypes2 = _interopRequireDefault(_propTypes);
16
16
 
17
- var _react = require('react');
18
-
19
- var _react2 = _interopRequireDefault(_react);
20
-
21
17
  var _elementResizeEvent = require('element-resize-event');
22
18
 
23
19
  var _elementResizeEvent2 = _interopRequireDefault(_elementResizeEvent);
@@ -39,7 +35,7 @@ var ReactEcharts = function (_React$Component) {
39
35
  var _this = _possibleConstructorReturn(this, (ReactEcharts.__proto__ || Object.getPrototypeOf(ReactEcharts)).call(this, props));
40
36
 
41
37
  _this.getEchartsInstance = function () {
42
- return _echarts2['default'].getInstanceByDom(_this.echartsElement) || _echarts2['default'].init(_this.echartsElement, _this.props.theme);
38
+ return _this.echartsInstance.getInstanceByDom(_this.echartsElement) || _this.echartsInstance.init(_this.echartsElement, _this.props.theme);
43
39
  };
44
40
 
45
41
  _this.bindEvents = function (instance, events) {
@@ -72,6 +68,7 @@ var ReactEcharts = function (_React$Component) {
72
68
  return echartObj;
73
69
  };
74
70
 
71
+ _this.echartsInstance = _this.props.echarts; // the echarts object.
75
72
  _this.echartsElement = null; // echarts div element
76
73
  return _this;
77
74
  }
@@ -114,7 +111,7 @@ var ReactEcharts = function (_React$Component) {
114
111
  if (typeof _elementResizeEvent2['default'].unbind === 'function') {
115
112
  _elementResizeEvent2['default'].unbind(this.echartsElement);
116
113
  }
117
- _echarts2['default'].dispose(this.echartsElement);
114
+ this.echartsInstance.dispose(this.echartsElement);
118
115
  }
119
116
  }
120
117
  // return the echart object
@@ -152,6 +149,7 @@ exports['default'] = ReactEcharts;
152
149
 
153
150
  ReactEcharts.propTypes = {
154
151
  option: _propTypes2['default'].object.isRequired, // eslint-disable-line react/forbid-prop-types
152
+ echarts: _propTypes2['default'].object.isRequired, // eslint-disable-line react/forbid-prop-types
155
153
  notMerge: _propTypes2['default'].bool,
156
154
  lazyUpdate: _propTypes2['default'].bool,
157
155
  style: _propTypes2['default'].object, // eslint-disable-line react/forbid-prop-types
@@ -164,6 +162,7 @@ ReactEcharts.propTypes = {
164
162
  };
165
163
 
166
164
  ReactEcharts.defaultProps = {
165
+ echarts: {},
167
166
  notMerge: false,
168
167
  lazyUpdate: false,
169
168
  style: { height: '300px' },
package/lib/index.js ADDED
@@ -0,0 +1,39 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _echarts = require('echarts');
8
+
9
+ var _echarts2 = _interopRequireDefault(_echarts);
10
+
11
+ var _core = require('./core');
12
+
13
+ var _core2 = _interopRequireDefault(_core);
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
16
+
17
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18
+
19
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
20
+
21
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
22
+
23
+ // export the Component the echarts Object.
24
+ var EchartsReact = function (_Core) {
25
+ _inherits(EchartsReact, _Core);
26
+
27
+ function EchartsReact(props) {
28
+ _classCallCheck(this, EchartsReact);
29
+
30
+ var _this = _possibleConstructorReturn(this, (EchartsReact.__proto__ || Object.getPrototypeOf(EchartsReact)).call(this, props));
31
+
32
+ _this.echartsInstance = _echarts2['default'];
33
+ return _this;
34
+ }
35
+
36
+ return EchartsReact;
37
+ }(_core2['default']);
38
+
39
+ exports['default'] = EchartsReact;
package/package.json CHANGED
@@ -1,18 +1,23 @@
1
1
  {
2
2
  "name": "echarts-for-react",
3
- "version": "1.2.5",
3
+ "version": "1.4.4",
4
4
  "description": "baidu Echarts(v3.0) components for react",
5
- "main": "lib/echarts-for-react",
5
+ "main": "lib/index.js",
6
+ "files": [
7
+ "src",
8
+ "lib"
9
+ ],
6
10
  "scripts": {
7
11
  "start": "webpack-dev-server --watch",
8
12
  "lint": "eslint src",
9
13
  "clean": "rimraf lib",
10
- "test": "npm run lint && npm run jest",
14
+ "test": "npm run lint && npm run cover",
11
15
  "demo": "webpack",
12
16
  "dev": "webpack --watch",
13
17
  "build": "npm run clean && cross-env NODE_ENV=production babel src -d lib && npm run demo",
14
18
  "prepublish": "npm run build",
15
- "jest": "jest"
19
+ "cover": "jest --coverage",
20
+ "coveralls": "cat ./coverage/lcov.info | coveralls"
16
21
  },
17
22
  "repository": {
18
23
  "type": "git",
@@ -37,59 +42,71 @@
37
42
  },
38
43
  "homepage": "https://github.com/hustcc/echarts-for-react",
39
44
  "devDependencies": {
40
- "react-adsense": "^0.0.1",
41
45
  "babel-cli": "^6.6.0",
42
46
  "babel-core": "^6.3.15",
43
47
  "babel-eslint": "^7.2.3",
48
+ "babel-jest": "^20.0.3",
44
49
  "babel-loader": "^6.2.0",
45
- "babel-preset-react-hmre": "^1.1.1",
50
+ "babel-plugin-transform-class-properties": "*",
51
+ "babel-plugin-transform-es3-member-expression-literals": "*",
52
+ "babel-plugin-transform-es3-property-literals": "*",
46
53
  "babel-preset-es2015": "^6.24.1",
47
54
  "babel-preset-react": "^6.24.1",
55
+ "babel-preset-react-hmre": "^1.1.1",
48
56
  "babel-preset-stage-0": "^6.24.1",
57
+ "coveralls": "^2.13.1",
58
+ "cross-env": "^1.0.8",
59
+ "css-loader": "~0.16.0",
60
+ "echarts": "^3.6.1",
61
+ "echarts-liquidfill": "~1.0.5",
62
+ "element-resize-event": "^2.0.5",
63
+ "enzyme": "^2.8.2",
49
64
  "eslint": "^3.19.0",
50
65
  "eslint-config-airbnb": "^14.1.0",
66
+ "eslint-config-airbnb-base": "^11.1.0",
51
67
  "eslint-plugin-babel": "^3.0.0",
52
68
  "eslint-plugin-import": "^2.2.0",
53
69
  "eslint-plugin-jsx-a11y": "^3.0.2 || ^4.0.0",
54
70
  "eslint-plugin-react": "^6.9.0",
55
- "eslint-config-airbnb-base": "^11.1.0",
71
+ "file-loader": "~0.8.4",
72
+ "immutability-util": "^0.0.1",
73
+ "jest": "^19.0.2",
74
+ "jsx-loader": "~0.13.2",
75
+ "prop-types": "^15.0.0",
56
76
  "react": "^15.5.0",
77
+ "react-adsense": "^0.0.2",
57
78
  "react-dom": "^15.5.0",
58
- "webpack": "^1.12.9",
59
- "webpack-dev-server": "^1.10.1",
60
- "css-loader": "~0.16.0",
61
- "jsx-loader": "~0.13.2",
62
- "style-loader": "~0.12.3",
63
- "file-loader": "~0.8.4",
64
- "rimraf": "^2.5.0",
65
- "cross-env": "^1.0.8",
66
- "echarts": "^3.1.1",
67
- "element-resize-event": "^2.0.5",
68
79
  "react-router": "^2.0.0",
69
- "babel-plugin-transform-es3-property-literals": "*",
70
- "babel-plugin-transform-es3-member-expression-literals": "*",
71
- "babel-plugin-transform-class-properties": "*",
72
- "echarts-liquidfill": "*",
73
- "enzyme": "^2.8.2",
74
- "jest": "^19.0.2",
75
80
  "react-test-renderer": "^15.5.4",
76
- "prop-types": "^15.0.0"
81
+ "rimraf": "^2.5.0",
82
+ "style-loader": "~0.12.3",
83
+ "webpack": "^1.12.9",
84
+ "webpack-dev-server": "^1.10.1"
77
85
  },
78
86
  "dependencies": {
79
- "echarts": "~3.5.0",
80
- "element-resize-event": "2.0.7"
87
+ "element-resize-event": "2.0.7",
88
+ "echarts": "^3.6.1"
81
89
  },
82
90
  "peerDependencies": {
83
91
  "react": ">=0.13.2 || ^0.14 || ^15.0.0 || >=16.0.0-alpha.1 <17.0.0",
84
- "prop-types": "^15.0.0"
92
+ "prop-types": ">=15.0.0"
85
93
  },
86
94
  "jest": {
87
- "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
95
+ "testRegex": "(/__tests__/.*\\.(test|spec))\\.(ts|tsx|js)$",
88
96
  "moduleFileExtensions": [
89
97
  "ts",
90
98
  "tsx",
91
99
  "js",
92
100
  "json"
101
+ ],
102
+ "transform": {
103
+ "^.+\\.js?$": "babel-jest"
104
+ },
105
+ "collectCoverage": true,
106
+ "collectCoverageFrom": [
107
+ "src/*.{js,jsx}",
108
+ "!**/node_modules/**",
109
+ "!**/vendor/**"
93
110
  ]
94
111
  }
95
112
  }
@@ -1,11 +1,11 @@
1
- import echarts from 'echarts';
2
- import PropTypes from 'prop-types';
3
1
  import React from 'react';
2
+ import PropTypes from 'prop-types';
4
3
  import elementResizeEvent from 'element-resize-event';
5
4
 
6
5
  export default class ReactEcharts extends React.Component {
7
- constructor(props) {
6
+ constructor(props) {
8
7
  super(props);
8
+ this.echartsInstance = this.props.echarts; // the echarts object.
9
9
  this.echartsElement = null; // echarts div element
10
10
  }
11
11
 
@@ -37,12 +37,12 @@ export default class ReactEcharts extends React.Component {
37
37
  if (typeof elementResizeEvent.unbind === 'function') {
38
38
  elementResizeEvent.unbind(this.echartsElement);
39
39
  }
40
- echarts.dispose(this.echartsElement);
40
+ this.echartsInstance.dispose(this.echartsElement);
41
41
  }
42
42
  }
43
43
  // return the echart object
44
- getEchartsInstance = () => echarts.getInstanceByDom(this.echartsElement) ||
45
- echarts.init(this.echartsElement, this.props.theme);
44
+ getEchartsInstance = () => this.echartsInstance.getInstanceByDom(this.echartsElement) ||
45
+ this.echartsInstance.init(this.echartsElement, this.props.theme);
46
46
 
47
47
  // bind the events
48
48
  bindEvents = (instance, events) => {
@@ -94,6 +94,7 @@ export default class ReactEcharts extends React.Component {
94
94
 
95
95
  ReactEcharts.propTypes = {
96
96
  option: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
97
+ echarts: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
97
98
  notMerge: PropTypes.bool,
98
99
  lazyUpdate: PropTypes.bool,
99
100
  style: PropTypes.object, // eslint-disable-line react/forbid-prop-types
@@ -106,6 +107,7 @@ ReactEcharts.propTypes = {
106
107
  };
107
108
 
108
109
  ReactEcharts.defaultProps = {
110
+ echarts: {},
109
111
  notMerge: false,
110
112
  lazyUpdate: false,
111
113
  style: {height: '300px'},
package/src/index.js ADDED
@@ -0,0 +1,10 @@
1
+ import echarts from 'echarts';
2
+ import Core from './core';
3
+
4
+ // export the Component the echarts Object.
5
+ export default class EchartsReact extends Core {
6
+ constructor(props) {
7
+ super(props);
8
+ this.echartsInstance = echarts;
9
+ }
10
+ }
package/.babelrc DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "presets": ["es2015", "react", "stage-0"],
3
- "plugins": ["transform-es3-member-expression-literals", "transform-es3-property-literals", "transform-class-properties"],
4
- "env": {
5
- "development": {
6
- }
7
- }
8
- }
package/.eslintrc DELETED
@@ -1,54 +0,0 @@
1
- {
2
- "parser": "babel-eslint",
3
- "env": {
4
- "browser": true,
5
- "node": true,
6
- "mocha": true
7
- },
8
- "extends": [
9
- "eslint-config-airbnb"
10
- ],
11
- "globals": {
12
- },
13
- "rules": {
14
- "comma-dangle": 0,
15
- "consistent-return": 0,
16
- "func-names": 0,
17
- "global-require": 0,
18
- "import/no-extraneous-dependencies": 0,
19
- "import/no-unresolved": 0,
20
- "indent": 0,
21
- "key-spacing": 0,
22
- "linebreak-style": 0,
23
- "new-cap": 0,
24
- "no-cond-assign": 0,
25
- "no-empty": 0,
26
- "no-fallthrough": 0,
27
- "no-loop-func": 0,
28
- "no-mixed-operators": 0,
29
- "no-new": 0,
30
- "no-param-reassign": 0,
31
- "no-restricted-syntax": 0,
32
- "no-return-assign": 0,
33
- "no-underscore-dangle": 0,
34
- "object-curly-spacing": 0,
35
- "prefer-rest-params": 0,
36
- "react/jsx-filename-extension": 0,
37
- "react/jsx-space-before-closing": 0,
38
- "strict": 0,
39
- "max-len": [
40
- 2,
41
- 120,
42
- 4,
43
- {
44
- "ignoreUrls": true
45
- }
46
- ],
47
- "id-length": [
48
- 2,
49
- {
50
- "min": 1
51
- }
52
- ]
53
- }
54
- }
package/.npmignore DELETED
@@ -1,3 +0,0 @@
1
- node_modules/
2
- npm-debug.*
3
- .idea
package/.travis.yml DELETED
@@ -1,3 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - "6.10.2"
@@ -1,63 +0,0 @@
1
- import React from 'react';
2
- import ReactEcharts from '../';
3
- import { shallow } from 'enzyme';
4
-
5
- test('test echarts-for-react of simple echarts option.`', () => {
6
- let option = {
7
- title: {
8
- text: '堆叠区域图'
9
- },
10
- tooltip : {
11
- trigger: 'axis'
12
- },
13
- legend: {
14
- data:['邮件营销','联盟广告','视频广告']
15
- },
16
- toolbox: {
17
- feature: {
18
- saveAsImage: {}
19
- }
20
- },
21
- grid: {
22
- left: '3%',
23
- right: '4%',
24
- bottom: '3%',
25
- containLabel: true
26
- },
27
- xAxis : [{
28
- type : 'category',
29
- boundaryGap : false,
30
- data : ['周一','周二','周三','周四','周五','周六','周日']
31
- }],
32
- yAxis : [{
33
- type : 'value'
34
- }],
35
- series : [{
36
- name:'邮件营销',
37
- type:'line',
38
- stack: '总量',
39
- areaStyle: {normal: {}},
40
- data:[120, 132, 101, 134, 90, 230, 210]
41
- }, {
42
- name:'联盟广告',
43
- type:'line',
44
- stack: '总量',
45
- areaStyle: {normal: {}},
46
- data:[220, 182, 191, 234, 290, 330, 310]
47
- }, {
48
- name:'视频广告',
49
- type:'line',
50
- stack: '总量',
51
- areaStyle: {normal: {}},
52
- data:[150, 232, 201, 154, 190, 330, 410]
53
- }]
54
- };
55
-
56
- let component = shallow(
57
- <ReactEcharts option={option}
58
- className='my_echarts'
59
- style={{height: '400px'}} />
60
- );
61
- let echarts_div = component.find('div');
62
- expect(echarts_div.length).toBe(1);
63
- });