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.
@@ -1,203 +0,0 @@
1
- import React from 'react';
2
- import ReactEcharts from '../lib/echarts-for-react';
3
-
4
- require("echarts/map/js/china.js");
5
-
6
- const MapChartComponent = React.createClass({
7
- propTypes: {
8
- },
9
- timeTicket: null,
10
- getInitialState: function() {
11
- return {option: this.getOtion()};
12
- },
13
- componentDidMount: function() {
14
- if (this.timeTicket) {
15
- clearInterval(this.timeTicket);
16
- }
17
- this.timeTicket = setInterval(() => {
18
- const option = this.state.option;
19
- const r = new Date().getSeconds();
20
- option.title.text = 'iphone销量' + r;
21
- option.series[0].name = 'iphone销量' + r;
22
- option.legend.data[0] = 'iphone销量' + r;
23
- this.setState({ option: option });
24
- }, 1000);
25
- },
26
- componentWillUnmount: function() {
27
- if (this.timeTicket) {
28
- clearInterval(this.timeTicket);
29
- }
30
- },
31
- randomData: function() {
32
- return Math.round(Math.random()*1000);
33
- },
34
- getOtion: function() {
35
- const option = {
36
- title: {
37
- text: 'iphone销量',
38
- subtext: '纯属虚构',
39
- left: 'center'
40
- },
41
- tooltip: {
42
- trigger: 'item'
43
- },
44
- legend: {
45
- orient: 'vertical',
46
- left: 'left',
47
- data:['iphone3','iphone4','iphone5']
48
- },
49
- visualMap: {
50
- min: 0,
51
- max: 2500,
52
- left: 'left',
53
- top: 'bottom',
54
- text: ['高','低'], // 文本,默认为数值文本
55
- calculable: true
56
- },
57
- toolbox: {
58
- show: true,
59
- orient: 'vertical',
60
- left: 'right',
61
- top: 'center',
62
- feature: {
63
- dataView: {readOnly: false},
64
- restore: {},
65
- saveAsImage: {}
66
- }
67
- },
68
- series: [
69
- {
70
- name: 'iphone3',
71
- type: 'map',
72
- mapType: 'china',
73
- roam: false,
74
- label: {
75
- normal: {
76
- show: true
77
- },
78
- emphasis: {
79
- show: true
80
- }
81
- },
82
- data:[
83
- {name: '北京',value: this.randomData() },
84
- {name: '天津',value: this.randomData() },
85
- {name: '上海',value: this.randomData() },
86
- {name: '重庆',value: this.randomData() },
87
- {name: '河北',value: this.randomData() },
88
- {name: '河南',value: this.randomData() },
89
- {name: '云南',value: this.randomData() },
90
- {name: '辽宁',value: this.randomData() },
91
- {name: '黑龙江',value: this.randomData() },
92
- {name: '湖南',value: this.randomData() },
93
- {name: '安徽',value: this.randomData() },
94
- {name: '山东',value: this.randomData() },
95
- {name: '新疆',value: this.randomData() },
96
- {name: '江苏',value: this.randomData() },
97
- {name: '浙江',value: this.randomData() },
98
- {name: '江西',value: this.randomData() },
99
- {name: '湖北',value: this.randomData() },
100
- {name: '广西',value: this.randomData() },
101
- {name: '甘肃',value: this.randomData() },
102
- {name: '山西',value: this.randomData() },
103
- {name: '内蒙古',value: this.randomData() },
104
- {name: '陕西',value: this.randomData() },
105
- {name: '吉林',value: this.randomData() },
106
- {name: '福建',value: this.randomData() },
107
- {name: '贵州',value: this.randomData() },
108
- {name: '广东',value: this.randomData() },
109
- {name: '青海',value: this.randomData() },
110
- {name: '西藏',value: this.randomData() },
111
- {name: '四川',value: this.randomData() },
112
- {name: '宁夏',value: this.randomData() },
113
- {name: '海南',value: this.randomData() },
114
- {name: '台湾',value: this.randomData() },
115
- {name: '香港',value: this.randomData() },
116
- {name: '澳门',value: this.randomData() }
117
- ]
118
- },
119
- {
120
- name: 'iphone4',
121
- type: 'map',
122
- mapType: 'china',
123
- label: {
124
- normal: {
125
- show: true
126
- },
127
- emphasis: {
128
- show: true
129
- }
130
- },
131
- data:[
132
- {name: '北京',value: this.randomData() },
133
- {name: '天津',value: this.randomData() },
134
- {name: '上海',value: this.randomData() },
135
- {name: '重庆',value: this.randomData() },
136
- {name: '河北',value: this.randomData() },
137
- {name: '安徽',value: this.randomData() },
138
- {name: '新疆',value: this.randomData() },
139
- {name: '浙江',value: this.randomData() },
140
- {name: '江西',value: this.randomData() },
141
- {name: '山西',value: this.randomData() },
142
- {name: '内蒙古',value: this.randomData() },
143
- {name: '吉林',value: this.randomData() },
144
- {name: '福建',value: this.randomData() },
145
- {name: '广东',value: this.randomData() },
146
- {name: '西藏',value: this.randomData() },
147
- {name: '四川',value: this.randomData() },
148
- {name: '宁夏',value: this.randomData() },
149
- {name: '香港',value: this.randomData() },
150
- {name: '澳门',value: this.randomData() }
151
- ]
152
- },
153
- {
154
- name: 'iphone5',
155
- type: 'map',
156
- mapType: 'china',
157
- label: {
158
- normal: {
159
- show: true
160
- },
161
- emphasis: {
162
- show: true
163
- }
164
- },
165
- data:[
166
- {name: '北京',value: this.randomData() },
167
- {name: '天津',value: this.randomData() },
168
- {name: '上海',value: this.randomData() },
169
- {name: '广东',value: this.randomData() },
170
- {name: '台湾',value: this.randomData() },
171
- {name: '香港',value: this.randomData() },
172
- {name: '澳门',value: this.randomData() }
173
- ]
174
- }
175
- ]
176
- };
177
- return option;
178
- },
179
- render: function() {
180
- let code = "require('echarts/map/js/china.js'); \n" +
181
- "<ReactEcharts \n" +
182
- " option={this.state.option || {}} \n" +
183
- " style={{height: '350px', width: '100%'}} \n" +
184
- " className='react_for_echarts' />";
185
- return (
186
- <div className='examples'>
187
- <div className='parent'>
188
- <label> render a china map. <strong>MAP charts</strong>: </label>
189
- <ReactEcharts
190
- option={this.state.option}
191
- style={{height: '500px', width: '100%'}}
192
- className='react_for_echarts' />
193
- <label> code below: </label>
194
- <pre>
195
- <code>{code}</code>
196
- </pre>
197
- </div>
198
- </div>
199
- );
200
- }
201
- });
202
-
203
- export default MapChartComponent;
@@ -1,54 +0,0 @@
1
- import React from 'react';
2
- import ReactEcharts from '../src/echarts-for-react';
3
-
4
- // require.config({
5
- // paths: {
6
- // echarts:'../node_modules/echarts',
7
- // }
8
- // });
9
-
10
- const ModuleLoadChartComponent = React.createClass({
11
- propTypes: {
12
- },
13
- getOtion: function() {
14
- const option = {
15
- title: { text: 'ECharts 入门示例' },
16
- tooltip: {},
17
- xAxis: {
18
- data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
19
- },
20
- yAxis: {},
21
- series: [{
22
- name: '销量',
23
- type: 'bar',
24
- data: [5, 20, 36, 10, 10, 20]
25
- }]
26
- };
27
- return option;
28
- },
29
- render: function() {
30
- let code = "<ReactEcharts \n" +
31
- " option={this.getOtion()} \n" +
32
- " style={{height: '350px', width: '100%'}} \n" +
33
- " modules={['echarts/lib/chart/bar', 'echarts/lib/component/tooltip', 'echarts/lib/component/title']} \n" +
34
- " className='react_for_echarts' />";
35
- return (
36
- <div className='examples'>
37
- <div className='parent'>
38
- <label> load echarts module as you wish <strong>reduce the file size</strong>: </label>
39
- <ReactEcharts
40
- option={this.getOtion()}
41
- style={{height: '350px', width: '100%'}}
42
- modules={['echarts/lib/chart/bar', 'echarts/lib/component/tooltip', 'echarts/lib/component/title']}
43
- className='react_for_echarts' />
44
- <label> code below: </label>
45
- <pre>
46
- <code>{code}</code>
47
- </pre>
48
- </div>
49
- </div>
50
- );
51
- }
52
- });
53
-
54
- export default ModuleLoadChartComponent;
@@ -1,90 +0,0 @@
1
- import React from 'react';
2
- import ReactEcharts from '../lib/echarts-for-react';
3
-
4
- const SimpleChartComponent = React.createClass({
5
- propTypes: {
6
- },
7
- getOtion: function() {
8
- const option = {
9
- title: {
10
- text: '堆叠区域图'
11
- },
12
- tooltip : {
13
- trigger: 'axis'
14
- },
15
- legend: {
16
- data:['邮件营销','联盟广告','视频广告']
17
- },
18
- toolbox: {
19
- feature: {
20
- saveAsImage: {}
21
- }
22
- },
23
- grid: {
24
- left: '3%',
25
- right: '4%',
26
- bottom: '3%',
27
- containLabel: true
28
- },
29
- xAxis : [
30
- {
31
- type : 'category',
32
- boundaryGap : false,
33
- data : ['周一','周二','周三','周四','周五','周六','周日']
34
- }
35
- ],
36
- yAxis : [
37
- {
38
- type : 'value'
39
- }
40
- ],
41
- series : [
42
- {
43
- name:'邮件营销',
44
- type:'line',
45
- stack: '总量',
46
- areaStyle: {normal: {}},
47
- data:[120, 132, 101, 134, 90, 230, 210]
48
- },
49
- {
50
- name:'联盟广告',
51
- type:'line',
52
- stack: '总量',
53
- areaStyle: {normal: {}},
54
- data:[220, 182, 191, 234, 290, 330, 310]
55
- },
56
- {
57
- name:'视频广告',
58
- type:'line',
59
- stack: '总量',
60
- areaStyle: {normal: {}},
61
- data:[150, 232, 201, 154, 190, 330, 410]
62
- }
63
- ]
64
- };
65
- return option;
66
- },
67
- render: function() {
68
- let code = "<ReactEcharts \n" +
69
- " option={this.getOtion()} \n" +
70
- " style={{height: '350px', width: '100%'}} \n" +
71
- " className='react_for_echarts' />";
72
- return (
73
- <div className='examples'>
74
- <div className='parent'>
75
- <label> render a Simple echart With <strong>option and height</strong>: </label>
76
- <ReactEcharts
77
- option={this.getOtion()}
78
- style={{height: '350px', width: '100%'}}
79
- className='react_for_echarts' />
80
- <label> code below: </label>
81
- <pre>
82
- <code>{code}</code>
83
- </pre>
84
- </div>
85
- </div>
86
- );
87
- }
88
- });
89
-
90
- export default SimpleChartComponent;
@@ -1,114 +0,0 @@
1
- import React from 'react';
2
- import ReactEcharts from '../lib/echarts-for-react';
3
-
4
- import echarts from 'echarts';
5
-
6
- const ThemeChartComponent = React.createClass({
7
- propTypes: {
8
- },
9
- getOtion: function() {
10
- const option = {
11
- title: {
12
- text: '阶梯瀑布图',
13
- subtext: 'From ExcelHome',
14
- sublink: 'http://e.weibo.com/1341556070/Aj1J2x5a5'
15
- },
16
- tooltip : {
17
- trigger: 'axis',
18
- axisPointer : { // 坐标轴指示器,坐标轴触发有效
19
- type : 'shadow' // 默认为直线,可选为:'line' | 'shadow'
20
- }
21
- },
22
- legend: {
23
- data:['支出','收入']
24
- },
25
- grid: {
26
- left: '3%',
27
- right: '4%',
28
- bottom: '3%',
29
- containLabel: true
30
- },
31
- xAxis: {
32
- type : 'category',
33
- splitLine: {show:false},
34
- data : ["11月1日", "11月2日", "11月3日", "11月4日", "11月5日", "11月6日", "11月7日", "11月8日", "11月9日", "11月10日", "11月11日"]
35
- },
36
- yAxis: {
37
- type : 'value'
38
- },
39
- series: [
40
- {
41
- name: '辅助',
42
- type: 'bar',
43
- stack: '总量',
44
- itemStyle: {
45
- normal: {
46
- barBorderColor: 'rgba(0,0,0,0)',
47
- color: 'rgba(0,0,0,0)'
48
- },
49
- emphasis: {
50
- barBorderColor: 'rgba(0,0,0,0)',
51
- color: 'rgba(0,0,0,0)'
52
- }
53
- },
54
- data: [0, 900, 1245, 1530, 1376, 1376, 1511, 1689, 1856, 1495, 1292]
55
- },
56
- {
57
- name: '收入',
58
- type: 'bar',
59
- stack: '总量',
60
- label: {
61
- normal: {
62
- show: true,
63
- position: 'top'
64
- }
65
- },
66
- data: [900, 345, 393, '-', '-', 135, 178, 286, '-', '-', '-']
67
- },
68
- {
69
- name: '支出',
70
- type: 'bar',
71
- stack: '总量',
72
- label: {
73
- normal: {
74
- show: true,
75
- position: 'bottom'
76
- }
77
- },
78
- data: ['-', '-', '-', 108, 154, '-', '-', '-', 119, 361, 203]
79
- }
80
- ]
81
- };
82
- return option;
83
- },
84
- registerTheme: function() {
85
- echarts.registerTheme('my_theme', {
86
- backgroundColor: '#f4cccc'
87
- });
88
- },
89
- render: function() {
90
- this.registerTheme();
91
- let code = "echarts.registerTheme('my_theme', {\n" +
92
- " backgroundColor: '#f4cccc'\n" +
93
- "});\n\n" +
94
- "<ReactEcharts \n" +
95
- " option={this.getOtion()} \n" +
96
- " theme='my_theme' />";
97
- return (
98
- <div className='examples'>
99
- <div className='parent'>
100
- <label> render a echart With <strong>theme</strong>, should <strong>echarts.registerTheme(themeName, themeObj)</strong> before use.</label>
101
- <ReactEcharts
102
- option={this.getOtion()}
103
- theme="my_theme" />
104
- <label> the theme object format: https://github.com/ecomfe/echarts/blob/master/theme/dark.js</label>
105
- <pre>
106
- <code>{code}</code>
107
- </pre>
108
- </div>
109
- </div>
110
- );
111
- }
112
- });
113
-
114
- export default ThemeChartComponent;