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 +52 -28
- package/lib/{echarts-for-react.js → core.js} +7 -8
- package/lib/index.js +39 -0
- package/package.json +45 -28
- package/src/{echarts-for-react.js → core.js} +8 -6
- package/src/index.js +10 -0
- package/.babelrc +0 -8
- package/.eslintrc +0 -54
- package/.npmignore +0 -3
- package/.travis.yml +0 -3
- package/__tests__/test.spec.js +0 -63
- package/demo/AirportCoordComponent.jsx +0 -321
- package/demo/CalendarComponent.jsx +0 -199
- package/demo/ChartAPIComponent.jsx +0 -127
- package/demo/ChartShowLoadingComponent.jsx +0 -93
- package/demo/ChartWithEventComponent.jsx +0 -93
- package/demo/DynamicChartComponent.jsx +0 -189
- package/demo/EchartsComponent.jsx +0 -47
- package/demo/GCalendarComponent.jsx +0 -72
- package/demo/GaugeComponent.jsx +0 -323
- package/demo/GraphComponent.jsx +0 -54
- package/demo/LiquidfillComponent.jsx +0 -32
- package/demo/LunarCalendarComponent.jsx +0 -492
- package/demo/MainPageComponent.jsx +0 -48
- package/demo/MapChartComponent.jsx +0 -203
- package/demo/ModuleLoadChartComponent.jsx +0 -54
- package/demo/SimpleChartComponent.jsx +0 -90
- package/demo/ThemeChartComponent.jsx +0 -114
- package/demo/TreemapComponent.jsx +0 -273
- package/demo/demo.css +0 -151
- package/demo/demo.jsx +0 -17
- package/demo/dist/bundle.js +0 -67
- package/demo/dist/bundle.js.map +0 -1
- package/index.html +0 -20
- package/webpack.config.js +0 -27
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ReactEcharts from '../lib/echarts-for-react';
|
|
3
|
-
import echarts from 'echarts';
|
|
4
|
-
require("echarts/map/js/china.js");
|
|
5
|
-
|
|
6
|
-
const AirportCoordComponent = React.createClass({
|
|
7
|
-
getOtion: function() {
|
|
8
|
-
var geoCoordMap = {
|
|
9
|
-
'上海': [121.4648,31.2891],
|
|
10
|
-
'东莞': [113.8953,22.901],
|
|
11
|
-
'东营': [118.7073,37.5513],
|
|
12
|
-
'中山': [113.4229,22.478],
|
|
13
|
-
'临汾': [111.4783,36.1615],
|
|
14
|
-
'临沂': [118.3118,35.2936],
|
|
15
|
-
'丹东': [124.541,40.4242],
|
|
16
|
-
'丽水': [119.5642,28.1854],
|
|
17
|
-
'乌鲁木齐': [87.9236,43.5883],
|
|
18
|
-
'佛山': [112.8955,23.1097],
|
|
19
|
-
'保定': [115.0488,39.0948],
|
|
20
|
-
'兰州': [103.5901,36.3043],
|
|
21
|
-
'包头': [110.3467,41.4899],
|
|
22
|
-
'北京': [116.4551,40.2539],
|
|
23
|
-
'北海': [109.314,21.6211],
|
|
24
|
-
'南京': [118.8062,31.9208],
|
|
25
|
-
'南宁': [108.479,23.1152],
|
|
26
|
-
'南昌': [116.0046,28.6633],
|
|
27
|
-
'南通': [121.1023,32.1625],
|
|
28
|
-
'厦门': [118.1689,24.6478],
|
|
29
|
-
'台州': [121.1353,28.6688],
|
|
30
|
-
'合肥': [117.29,32.0581],
|
|
31
|
-
'呼和浩特': [111.4124,40.4901],
|
|
32
|
-
'咸阳': [108.4131,34.8706],
|
|
33
|
-
'哈尔滨': [127.9688,45.368],
|
|
34
|
-
'唐山': [118.4766,39.6826],
|
|
35
|
-
'嘉兴': [120.9155,30.6354],
|
|
36
|
-
'大同': [113.7854,39.8035],
|
|
37
|
-
'大连': [122.2229,39.4409],
|
|
38
|
-
'天津': [117.4219,39.4189],
|
|
39
|
-
'太原': [112.3352,37.9413],
|
|
40
|
-
'威海': [121.9482,37.1393],
|
|
41
|
-
'宁波': [121.5967,29.6466],
|
|
42
|
-
'宝鸡': [107.1826,34.3433],
|
|
43
|
-
'宿迁': [118.5535,33.7775],
|
|
44
|
-
'常州': [119.4543,31.5582],
|
|
45
|
-
'广州': [113.5107,23.2196],
|
|
46
|
-
'廊坊': [116.521,39.0509],
|
|
47
|
-
'延安': [109.1052,36.4252],
|
|
48
|
-
'张家口': [115.1477,40.8527],
|
|
49
|
-
'徐州': [117.5208,34.3268],
|
|
50
|
-
'德州': [116.6858,37.2107],
|
|
51
|
-
'惠州': [114.6204,23.1647],
|
|
52
|
-
'成都': [103.9526,30.7617],
|
|
53
|
-
'扬州': [119.4653,32.8162],
|
|
54
|
-
'承德': [117.5757,41.4075],
|
|
55
|
-
'拉萨': [91.1865,30.1465],
|
|
56
|
-
'无锡': [120.3442,31.5527],
|
|
57
|
-
'日照': [119.2786,35.5023],
|
|
58
|
-
'昆明': [102.9199,25.4663],
|
|
59
|
-
'杭州': [119.5313,29.8773],
|
|
60
|
-
'枣庄': [117.323,34.8926],
|
|
61
|
-
'柳州': [109.3799,24.9774],
|
|
62
|
-
'株洲': [113.5327,27.0319],
|
|
63
|
-
'武汉': [114.3896,30.6628],
|
|
64
|
-
'汕头': [117.1692,23.3405],
|
|
65
|
-
'江门': [112.6318,22.1484],
|
|
66
|
-
'沈阳': [123.1238,42.1216],
|
|
67
|
-
'沧州': [116.8286,38.2104],
|
|
68
|
-
'河源': [114.917,23.9722],
|
|
69
|
-
'泉州': [118.3228,25.1147],
|
|
70
|
-
'泰安': [117.0264,36.0516],
|
|
71
|
-
'泰州': [120.0586,32.5525],
|
|
72
|
-
'济南': [117.1582,36.8701],
|
|
73
|
-
'济宁': [116.8286,35.3375],
|
|
74
|
-
'海口': [110.3893,19.8516],
|
|
75
|
-
'淄博': [118.0371,36.6064],
|
|
76
|
-
'淮安': [118.927,33.4039],
|
|
77
|
-
'深圳': [114.5435,22.5439],
|
|
78
|
-
'清远': [112.9175,24.3292],
|
|
79
|
-
'温州': [120.498,27.8119],
|
|
80
|
-
'渭南': [109.7864,35.0299],
|
|
81
|
-
'湖州': [119.8608,30.7782],
|
|
82
|
-
'湘潭': [112.5439,27.7075],
|
|
83
|
-
'滨州': [117.8174,37.4963],
|
|
84
|
-
'潍坊': [119.0918,36.524],
|
|
85
|
-
'烟台': [120.7397,37.5128],
|
|
86
|
-
'玉溪': [101.9312,23.8898],
|
|
87
|
-
'珠海': [113.7305,22.1155],
|
|
88
|
-
'盐城': [120.2234,33.5577],
|
|
89
|
-
'盘锦': [121.9482,41.0449],
|
|
90
|
-
'石家庄': [114.4995,38.1006],
|
|
91
|
-
'福州': [119.4543,25.9222],
|
|
92
|
-
'秦皇岛': [119.2126,40.0232],
|
|
93
|
-
'绍兴': [120.564,29.7565],
|
|
94
|
-
'聊城': [115.9167,36.4032],
|
|
95
|
-
'肇庆': [112.1265,23.5822],
|
|
96
|
-
'舟山': [122.2559,30.2234],
|
|
97
|
-
'苏州': [120.6519,31.3989],
|
|
98
|
-
'莱芜': [117.6526,36.2714],
|
|
99
|
-
'菏泽': [115.6201,35.2057],
|
|
100
|
-
'营口': [122.4316,40.4297],
|
|
101
|
-
'葫芦岛': [120.1575,40.578],
|
|
102
|
-
'衡水': [115.8838,37.7161],
|
|
103
|
-
'衢州': [118.6853,28.8666],
|
|
104
|
-
'西宁': [101.4038,36.8207],
|
|
105
|
-
'西安': [109.1162,34.2004],
|
|
106
|
-
'贵阳': [106.6992,26.7682],
|
|
107
|
-
'连云港': [119.1248,34.552],
|
|
108
|
-
'邢台': [114.8071,37.2821],
|
|
109
|
-
'邯郸': [114.4775,36.535],
|
|
110
|
-
'郑州': [113.4668,34.6234],
|
|
111
|
-
'鄂尔多斯': [108.9734,39.2487],
|
|
112
|
-
'重庆': [107.7539,30.1904],
|
|
113
|
-
'金华': [120.0037,29.1028],
|
|
114
|
-
'铜川': [109.0393,35.1947],
|
|
115
|
-
'银川': [106.3586,38.1775],
|
|
116
|
-
'镇江': [119.4763,31.9702],
|
|
117
|
-
'长春': [125.8154,44.2584],
|
|
118
|
-
'长沙': [113.0823,28.2568],
|
|
119
|
-
'长治': [112.8625,36.4746],
|
|
120
|
-
'阳泉': [113.4778,38.0951],
|
|
121
|
-
'青岛': [120.4651,36.3373],
|
|
122
|
-
'韶关': [113.7964,24.7028]
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
var BJData = [
|
|
126
|
-
[{name:'北京'}, {name:'上海',value:95}],
|
|
127
|
-
[{name:'北京'}, {name:'广州',value:90}],
|
|
128
|
-
[{name:'北京'}, {name:'大连',value:80}],
|
|
129
|
-
[{name:'北京'}, {name:'南宁',value:70}],
|
|
130
|
-
[{name:'北京'}, {name:'南昌',value:60}],
|
|
131
|
-
[{name:'北京'}, {name:'拉萨',value:50}],
|
|
132
|
-
[{name:'北京'}, {name:'长春',value:40}],
|
|
133
|
-
[{name:'北京'}, {name:'包头',value:30}],
|
|
134
|
-
[{name:'北京'}, {name:'重庆',value:20}],
|
|
135
|
-
[{name:'北京'}, {name:'常州',value:10}]
|
|
136
|
-
];
|
|
137
|
-
|
|
138
|
-
var SHData = [
|
|
139
|
-
[{name:'上海'},{name:'包头',value:95}],
|
|
140
|
-
[{name:'上海'},{name:'昆明',value:90}],
|
|
141
|
-
[{name:'上海'},{name:'广州',value:80}],
|
|
142
|
-
[{name:'上海'},{name:'郑州',value:70}],
|
|
143
|
-
[{name:'上海'},{name:'长春',value:60}],
|
|
144
|
-
[{name:'上海'},{name:'重庆',value:50}],
|
|
145
|
-
[{name:'上海'},{name:'长沙',value:40}],
|
|
146
|
-
[{name:'上海'},{name:'北京',value:30}],
|
|
147
|
-
[{name:'上海'},{name:'丹东',value:20}],
|
|
148
|
-
[{name:'上海'},{name:'大连',value:10}]
|
|
149
|
-
];
|
|
150
|
-
|
|
151
|
-
var GZData = [
|
|
152
|
-
[{name:'广州'},{name:'福州',value:95}],
|
|
153
|
-
[{name:'广州'},{name:'太原',value:90}],
|
|
154
|
-
[{name:'广州'},{name:'长春',value:80}],
|
|
155
|
-
[{name:'广州'},{name:'重庆',value:70}],
|
|
156
|
-
[{name:'广州'},{name:'西安',value:60}],
|
|
157
|
-
[{name:'广州'},{name:'成都',value:50}],
|
|
158
|
-
[{name:'广州'},{name:'常州',value:40}],
|
|
159
|
-
[{name:'广州'},{name:'北京',value:30}],
|
|
160
|
-
[{name:'广州'},{name:'北海',value:20}],
|
|
161
|
-
[{name:'广州'},{name:'海口',value:10}]
|
|
162
|
-
];
|
|
163
|
-
|
|
164
|
-
var planePath = 'path://M1705.06,1318.313v-89.254l-319.9-221.799l0.073-208.063c0.521-84.662-26.629-121.796-63.961-121.491c-37.332-0.305-64.482,36.829-63.961,121.491l0.073,208.063l-319.9,221.799v89.254l330.343-157.288l12.238,241.308l-134.449,92.931l0.531,42.034l175.125-42.917l175.125,42.917l0.531-42.034l-134.449-92.931l12.238-241.308L1705.06,1318.313z';
|
|
165
|
-
|
|
166
|
-
var convertData = function (data) {
|
|
167
|
-
var res = [];
|
|
168
|
-
for (var i = 0; i < data.length; i++) {
|
|
169
|
-
var dataItem = data[i];
|
|
170
|
-
var fromCoord = geoCoordMap[dataItem[0].name];
|
|
171
|
-
var toCoord = geoCoordMap[dataItem[1].name];
|
|
172
|
-
if (fromCoord && toCoord) {
|
|
173
|
-
res.push({
|
|
174
|
-
fromName: dataItem[0].name,
|
|
175
|
-
toName: dataItem[1].name,
|
|
176
|
-
coords: [fromCoord, toCoord]
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
return res;
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
var color = ['#a6c84c', '#ffa022', '#46bee9'];
|
|
184
|
-
var series = [];
|
|
185
|
-
[['北京', BJData], ['上海', SHData], ['广州', GZData]].forEach(function (item, i) {
|
|
186
|
-
series.push({
|
|
187
|
-
name: item[0] + ' Top10',
|
|
188
|
-
type: 'lines',
|
|
189
|
-
zlevel: 1,
|
|
190
|
-
effect: {
|
|
191
|
-
show: true,
|
|
192
|
-
period: 6,
|
|
193
|
-
trailLength: 0.7,
|
|
194
|
-
color: '#fff',
|
|
195
|
-
symbolSize: 3
|
|
196
|
-
},
|
|
197
|
-
lineStyle: {
|
|
198
|
-
normal: {
|
|
199
|
-
color: color[i],
|
|
200
|
-
width: 0,
|
|
201
|
-
curveness: 0.2
|
|
202
|
-
}
|
|
203
|
-
},
|
|
204
|
-
data: convertData(item[1])
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
name: item[0] + ' Top10',
|
|
208
|
-
type: 'lines',
|
|
209
|
-
zlevel: 2,
|
|
210
|
-
symbol: ['none', 'arrow'],
|
|
211
|
-
symbolSize: 10,
|
|
212
|
-
effect: {
|
|
213
|
-
show: true,
|
|
214
|
-
period: 6,
|
|
215
|
-
trailLength: 0,
|
|
216
|
-
symbol: planePath,
|
|
217
|
-
symbolSize: 15
|
|
218
|
-
},
|
|
219
|
-
lineStyle: {
|
|
220
|
-
normal: {
|
|
221
|
-
color: color[i],
|
|
222
|
-
width: 1,
|
|
223
|
-
opacity: 0.6,
|
|
224
|
-
curveness: 0.2
|
|
225
|
-
}
|
|
226
|
-
},
|
|
227
|
-
data: convertData(item[1])
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
name: item[0] + ' Top10',
|
|
231
|
-
type: 'effectScatter',
|
|
232
|
-
coordinateSystem: 'geo',
|
|
233
|
-
zlevel: 2,
|
|
234
|
-
rippleEffect: {
|
|
235
|
-
brushType: 'stroke'
|
|
236
|
-
},
|
|
237
|
-
label: {
|
|
238
|
-
normal: {
|
|
239
|
-
show: true,
|
|
240
|
-
position: 'right',
|
|
241
|
-
formatter: '{b}'
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
|
-
symbolSize: function (val) {
|
|
245
|
-
return val[2] / 8;
|
|
246
|
-
},
|
|
247
|
-
itemStyle: {
|
|
248
|
-
normal: {
|
|
249
|
-
color: color[i]
|
|
250
|
-
}
|
|
251
|
-
},
|
|
252
|
-
data: item[1].map(function (dataItem) {
|
|
253
|
-
return {
|
|
254
|
-
name: dataItem[1].name,
|
|
255
|
-
value: geoCoordMap[dataItem[1].name].concat([dataItem[1].value])
|
|
256
|
-
};
|
|
257
|
-
})
|
|
258
|
-
});
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
var option = {
|
|
262
|
-
backgroundColor: '#404a59',
|
|
263
|
-
title : {
|
|
264
|
-
text: '模拟迁徙',
|
|
265
|
-
subtext: '数据纯属虚构',
|
|
266
|
-
left: 'center',
|
|
267
|
-
textStyle : {
|
|
268
|
-
color: '#fff'
|
|
269
|
-
}
|
|
270
|
-
},
|
|
271
|
-
tooltip : {
|
|
272
|
-
trigger: 'item'
|
|
273
|
-
},
|
|
274
|
-
legend: {
|
|
275
|
-
orient: 'vertical',
|
|
276
|
-
top: 'bottom',
|
|
277
|
-
left: 'right',
|
|
278
|
-
data:['北京 Top10', '上海 Top10', '广州 Top10'],
|
|
279
|
-
textStyle: {
|
|
280
|
-
color: '#fff'
|
|
281
|
-
},
|
|
282
|
-
selectedMode: 'single'
|
|
283
|
-
},
|
|
284
|
-
geo: {
|
|
285
|
-
map: 'china',
|
|
286
|
-
label: {
|
|
287
|
-
emphasis: {
|
|
288
|
-
show: false
|
|
289
|
-
}
|
|
290
|
-
},
|
|
291
|
-
roam: true,
|
|
292
|
-
itemStyle: {
|
|
293
|
-
normal: {
|
|
294
|
-
areaColor: '#323c48',
|
|
295
|
-
borderColor: '#404a59'
|
|
296
|
-
},
|
|
297
|
-
emphasis: {
|
|
298
|
-
areaColor: '#2a333d'
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
},
|
|
302
|
-
series: series
|
|
303
|
-
};
|
|
304
|
-
return option;
|
|
305
|
-
},
|
|
306
|
-
render: function() {
|
|
307
|
-
return (
|
|
308
|
-
<div className='examples'>
|
|
309
|
-
<div className='parent'>
|
|
310
|
-
<label> render a airport chart. </label>
|
|
311
|
-
<ReactEcharts
|
|
312
|
-
option={this.getOtion()}
|
|
313
|
-
style={{height: '700px', width: '100%'}}
|
|
314
|
-
className='react_for_echarts' />
|
|
315
|
-
</div>
|
|
316
|
-
</div>
|
|
317
|
-
);
|
|
318
|
-
}
|
|
319
|
-
});
|
|
320
|
-
|
|
321
|
-
export default AirportCoordComponent;
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ReactEcharts from '../lib/echarts-for-react';
|
|
3
|
-
import echarts from 'echarts';
|
|
4
|
-
|
|
5
|
-
const CalendarComponent = React.createClass({
|
|
6
|
-
getVirtulData: function(year) {
|
|
7
|
-
year = year || '2017';
|
|
8
|
-
var date = +echarts.number.parseDate(year + '-01-01');
|
|
9
|
-
var end = +echarts.number.parseDate((+year + 1) + '-01-01');
|
|
10
|
-
var dayTime = 3600 * 24 * 1000;
|
|
11
|
-
var data = [];
|
|
12
|
-
for (var time = date; time < end; time += dayTime) {
|
|
13
|
-
data.push([
|
|
14
|
-
echarts.format.formatTime('yyyy-MM-dd', time),
|
|
15
|
-
Math.floor(Math.random() * 1000)
|
|
16
|
-
]);
|
|
17
|
-
}
|
|
18
|
-
return data;
|
|
19
|
-
},
|
|
20
|
-
getOtion: function() {
|
|
21
|
-
var graphData = [[
|
|
22
|
-
1485878400000,
|
|
23
|
-
260
|
|
24
|
-
],[
|
|
25
|
-
1486137600000,
|
|
26
|
-
200
|
|
27
|
-
],[
|
|
28
|
-
1486569600000,
|
|
29
|
-
279
|
|
30
|
-
],[
|
|
31
|
-
1486915200000,
|
|
32
|
-
847
|
|
33
|
-
],[
|
|
34
|
-
1487347200000,
|
|
35
|
-
241
|
|
36
|
-
], [
|
|
37
|
-
1487779200000,
|
|
38
|
-
411
|
|
39
|
-
], [
|
|
40
|
-
1488124800000,
|
|
41
|
-
985
|
|
42
|
-
]
|
|
43
|
-
];
|
|
44
|
-
|
|
45
|
-
var links = graphData.map(function (item, idx) {
|
|
46
|
-
return {
|
|
47
|
-
source: idx,
|
|
48
|
-
target: idx + 1
|
|
49
|
-
};
|
|
50
|
-
});
|
|
51
|
-
links.pop();
|
|
52
|
-
|
|
53
|
-
const option = {
|
|
54
|
-
tooltip: {
|
|
55
|
-
position: 'top'
|
|
56
|
-
},
|
|
57
|
-
visualMap: [{
|
|
58
|
-
min: 0,
|
|
59
|
-
max: 1000,
|
|
60
|
-
calculable: true,
|
|
61
|
-
seriesIndex: [2, 3, 4],
|
|
62
|
-
orient: 'horizontal',
|
|
63
|
-
left: '55%',
|
|
64
|
-
bottom: 20
|
|
65
|
-
}, {
|
|
66
|
-
min: 0,
|
|
67
|
-
max: 1000,
|
|
68
|
-
inRange: {
|
|
69
|
-
color: ['grey'],
|
|
70
|
-
opacity: [0, 0.3]
|
|
71
|
-
},
|
|
72
|
-
controller: {
|
|
73
|
-
inRange: {
|
|
74
|
-
opacity: [0.3, 0.6]
|
|
75
|
-
},
|
|
76
|
-
outOfRange: {
|
|
77
|
-
color: '#ccc'
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
calculable: true,
|
|
81
|
-
seriesIndex: [1],
|
|
82
|
-
orient: 'horizontal',
|
|
83
|
-
left: '10%',
|
|
84
|
-
bottom: 20
|
|
85
|
-
}],
|
|
86
|
-
|
|
87
|
-
calendar: [
|
|
88
|
-
{
|
|
89
|
-
orient: 'vertical',
|
|
90
|
-
yearLabel: {
|
|
91
|
-
margin: 40
|
|
92
|
-
},
|
|
93
|
-
monthLabel: {
|
|
94
|
-
nameMap: 'cn',
|
|
95
|
-
margin: 20
|
|
96
|
-
},
|
|
97
|
-
dayLabel: {
|
|
98
|
-
firstDay: 1,
|
|
99
|
-
nameMap: 'cn'
|
|
100
|
-
},
|
|
101
|
-
cellSize: 40,
|
|
102
|
-
range: '2017-02'
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
orient: 'vertical',
|
|
106
|
-
yearLabel: {
|
|
107
|
-
margin: 40
|
|
108
|
-
},
|
|
109
|
-
monthLabel: {
|
|
110
|
-
margin: 20
|
|
111
|
-
},
|
|
112
|
-
cellSize: 40,
|
|
113
|
-
left: 460,
|
|
114
|
-
range: '2017-01'
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
orient: 'vertical',
|
|
118
|
-
yearLabel: {
|
|
119
|
-
margin: 40
|
|
120
|
-
},
|
|
121
|
-
monthLabel: {
|
|
122
|
-
margin: 20
|
|
123
|
-
},
|
|
124
|
-
cellSize: 40,
|
|
125
|
-
top: 350,
|
|
126
|
-
range: '2017-03'
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
orient: 'vertical',
|
|
130
|
-
yearLabel: {
|
|
131
|
-
margin: 40
|
|
132
|
-
},
|
|
133
|
-
dayLabel: {
|
|
134
|
-
firstDay: 1,
|
|
135
|
-
nameMap: ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
|
|
136
|
-
},
|
|
137
|
-
monthLabel: {
|
|
138
|
-
nameMap: 'cn',
|
|
139
|
-
margin: 20
|
|
140
|
-
},
|
|
141
|
-
cellSize: 40,
|
|
142
|
-
top: 350,
|
|
143
|
-
left: 460,
|
|
144
|
-
range: '2017-04'
|
|
145
|
-
}],
|
|
146
|
-
|
|
147
|
-
series: [{
|
|
148
|
-
type: 'graph',
|
|
149
|
-
edgeSymbol: ['none', 'arrow'],
|
|
150
|
-
coordinateSystem: 'calendar',
|
|
151
|
-
links: links,
|
|
152
|
-
symbolSize: 10,
|
|
153
|
-
calendarIndex: 0,
|
|
154
|
-
data: graphData
|
|
155
|
-
}, {
|
|
156
|
-
type: 'heatmap',
|
|
157
|
-
coordinateSystem: 'calendar',
|
|
158
|
-
data: this.getVirtulData(2017)
|
|
159
|
-
}, {
|
|
160
|
-
type: 'effectScatter',
|
|
161
|
-
coordinateSystem: 'calendar',
|
|
162
|
-
calendarIndex: 1,
|
|
163
|
-
symbolSize: function (val) {
|
|
164
|
-
return val[1] / 40;
|
|
165
|
-
},
|
|
166
|
-
data: this.getVirtulData(2017)
|
|
167
|
-
}, {
|
|
168
|
-
type: 'scatter',
|
|
169
|
-
coordinateSystem: 'calendar',
|
|
170
|
-
calendarIndex: 2,
|
|
171
|
-
symbolSize: function (val) {
|
|
172
|
-
return val[1] / 60;
|
|
173
|
-
},
|
|
174
|
-
data: this.getVirtulData(2017)
|
|
175
|
-
}, {
|
|
176
|
-
type: 'heatmap',
|
|
177
|
-
coordinateSystem: 'calendar',
|
|
178
|
-
calendarIndex: 3,
|
|
179
|
-
data: this.getVirtulData(2017)
|
|
180
|
-
}]
|
|
181
|
-
};
|
|
182
|
-
return option
|
|
183
|
-
},
|
|
184
|
-
render: function() {
|
|
185
|
-
return (
|
|
186
|
-
<div className='examples'>
|
|
187
|
-
<div className='parent'>
|
|
188
|
-
<label> render a calendar-charts </label>
|
|
189
|
-
<ReactEcharts
|
|
190
|
-
option={this.getOtion()}
|
|
191
|
-
style={{height: '700px', width: '100%'}}
|
|
192
|
-
className='react_for_echarts' />
|
|
193
|
-
</div>
|
|
194
|
-
</div>
|
|
195
|
-
);
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
export default CalendarComponent;
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ReactEcharts from '../lib/echarts-for-react';
|
|
3
|
-
|
|
4
|
-
const ChartAPIComponent = React.createClass({
|
|
5
|
-
propTypes: {
|
|
6
|
-
},
|
|
7
|
-
getOtion: function() {
|
|
8
|
-
const option = {
|
|
9
|
-
title: {
|
|
10
|
-
text: '漏斗图',
|
|
11
|
-
subtext: '纯属虚构'
|
|
12
|
-
},
|
|
13
|
-
tooltip: {
|
|
14
|
-
trigger: 'item',
|
|
15
|
-
formatter: "{a} <br/>{b} : {c}%"
|
|
16
|
-
},
|
|
17
|
-
toolbox: {
|
|
18
|
-
feature: {
|
|
19
|
-
dataView: {readOnly: false},
|
|
20
|
-
restore: {},
|
|
21
|
-
saveAsImage: {}
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
legend: {
|
|
25
|
-
data: ['展现','点击','访问','咨询','订单']
|
|
26
|
-
},
|
|
27
|
-
series: [
|
|
28
|
-
{
|
|
29
|
-
name: '预期',
|
|
30
|
-
type: 'funnel',
|
|
31
|
-
left: '10%',
|
|
32
|
-
width: '80%',
|
|
33
|
-
label: {
|
|
34
|
-
normal: {
|
|
35
|
-
formatter: '{b}预期'
|
|
36
|
-
},
|
|
37
|
-
emphasis: {
|
|
38
|
-
position:'inside',
|
|
39
|
-
formatter: '{b}预期: {c}%'
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
labelLine: {
|
|
43
|
-
normal: {
|
|
44
|
-
show: false
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
itemStyle: {
|
|
48
|
-
normal: {
|
|
49
|
-
opacity: 0.7
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
data: [
|
|
53
|
-
{value: 60, name: '访问'},
|
|
54
|
-
{value: 40, name: '咨询'},
|
|
55
|
-
{value: 20, name: '订单'},
|
|
56
|
-
{value: 80, name: '点击'},
|
|
57
|
-
{value: 100, name: '展现'}
|
|
58
|
-
]
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: '实际',
|
|
62
|
-
type: 'funnel',
|
|
63
|
-
left: '10%',
|
|
64
|
-
width: '80%',
|
|
65
|
-
maxSize: '80%',
|
|
66
|
-
label: {
|
|
67
|
-
normal: {
|
|
68
|
-
position: 'inside',
|
|
69
|
-
formatter: '{c}%',
|
|
70
|
-
textStyle: {
|
|
71
|
-
color: '#fff'
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
emphasis: {
|
|
75
|
-
position:'inside',
|
|
76
|
-
formatter: '{b}实际: {c}%'
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
itemStyle: {
|
|
80
|
-
normal: {
|
|
81
|
-
opacity: 0.5,
|
|
82
|
-
borderColor: '#fff',
|
|
83
|
-
borderWidth: 2
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
data: [
|
|
87
|
-
{value: 30, name: '访问'},
|
|
88
|
-
{value: 10, name: '咨询'},
|
|
89
|
-
{value: 5, name: '订单'},
|
|
90
|
-
{value: 50, name: '点击'},
|
|
91
|
-
{value: 80, name: '展现'}
|
|
92
|
-
]
|
|
93
|
-
}
|
|
94
|
-
]
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
return option;
|
|
98
|
-
},
|
|
99
|
-
clickBtn: function() {
|
|
100
|
-
window.open(this.refs.echarts_react.getEchartsInstance().getDataURL(), '_blank');
|
|
101
|
-
},
|
|
102
|
-
render: function() {
|
|
103
|
-
let code = "<ReactEcharts ref='echartsInstance' \n" +
|
|
104
|
-
" option={this.getOtion()} /> \n" +
|
|
105
|
-
"\n" +
|
|
106
|
-
"// use echarts API: http://echarts.baidu.com/api.html#echartsInstance" +
|
|
107
|
-
"this.refs.echarts_react.getEchartsInstance().getDataURL();";
|
|
108
|
-
return (
|
|
109
|
-
<div className='examples'>
|
|
110
|
-
<div className='parent'>
|
|
111
|
-
<label> use echarts API With <strong> getEchartsInstance() </strong>: (the API will return the echarts instance, then you can use any API of echarts.)</label>
|
|
112
|
-
<ReactEcharts ref='echarts_react'
|
|
113
|
-
option={this.getOtion()} />
|
|
114
|
-
<div>
|
|
115
|
-
<button className='a_line' onClick={this.clickBtn}>click here to get the DataURL of chart.</button>
|
|
116
|
-
</div>
|
|
117
|
-
<label> code below: (echarts API list see: http://echarts.baidu.com/api.html#echartsInstance)</label>
|
|
118
|
-
<pre>
|
|
119
|
-
<code>{code}</code>
|
|
120
|
-
</pre>
|
|
121
|
-
</div>
|
|
122
|
-
</div>
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
export default ChartAPIComponent;
|