Project

General

Profile

1
$(function() {
2
    // geo lines
3
    altair_charts_echarts.chart_a();
4
    // stacked area
5
    altair_charts_echarts.chart_b();
6
    // bars
7
    altair_charts_echarts.chart_c();
8
    // area
9
    altair_charts_echarts.chart_d();
10
    // funnel
11
    altair_charts_echarts.chart_e();
12
});
13

    
14
altair_charts_echarts = {
15
    chart_a: function() {
16
        var dom = document.getElementById("chart_a"),
17
            myChart = echarts.init(dom),
18
            app = {};
19

    
20
        var option = {
21
            title: {
22
                text: 'Stacked area'
23
            },
24
            tooltip : {
25
                trigger: 'axis'
26
            },
27
            color: ['#00ACC1','#FB8C00','#E53935','#7CB342','#6D4C41'],
28
            legend: {
29
                data:['Email Marketing', 'Affiliate Ads', 'Video Ads', 'Direct Access', 'Search Engine'],
30
                bottom: '0'
31
            },
32
            toolbox: {
33
                right: 30,
34
                feature: {
35
                    saveAsImage: {
36
                        title: 'save as image'
37
                    }
38
                }
39
            },
40
            grid: {
41
                left: '3%',
42
                right: '4%',
43
                bottom: '10%',
44
                containLabel: true
45
            },
46
            xAxis : [
47
                {
48
                    type : 'category',
49
                    boundaryGap : false,
50
                    data : ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
51
                }
52
            ],
53
            yAxis : [
54
                {
55
                    type : 'value'
56
                }
57
            ],
58
            series : [
59
                {
60
                    name:'Email Marketing',
61
                    type:'line',
62
                    stack: 'Total',
63
                    lineStyle: {
64
                        normal: {
65
                            color: '#006064'
66
                        }
67
                    },
68
                    areaStyle: {
69
                        normal: {
70
                            color: '#00ACC1'
71
                        }
72
                    },
73
                    data:[120, 132, 101, 134, 90, 230, 210]
74
                },
75
                {
76
                    name:'Affiliate Ads',
77
                    type:'line',
78
                    stack: 'Total',
79
                    lineStyle: {
80
                        normal: {
81
                            color: '#E65100'
82
                        }
83
                    },
84
                    areaStyle: {
85
                        normal: {
86
                            color: '#FB8C00'
87
                        }
88
                    },
89
                    data:[220, 182, 191, 234, 290, 330, 310]
90
                },
91
                {
92
                    name:'Video Ads',
93
                    type:'line',
94
                    stack: 'Total',
95
                    lineStyle: {
96
                        normal: {
97
                            color: '#B71C1C'
98
                        }
99
                    },
100
                    areaStyle: {
101
                        normal: {
102
                            color: '#E53935'
103
                        }
104
                    },
105
                    data:[150, 232, 201, 154, 190, 330, 410]
106
                },
107
                {
108
                    name:'Direct Access',
109
                    type:'line',
110
                    stack: 'Total',
111
                    lineStyle: {
112
                        normal: {
113
                            color: '#33691E'
114
                        }
115
                    },
116
                    areaStyle: {
117
                        normal: {
118
                            color: '#7CB342'
119
                        }
120
                    },
121
                    data:[320, 332, 301, 334, 390, 330, 320]
122
                },
123
                {
124
                    name:'Search Engine',
125
                    type:'line',
126
                    stack: 'Total',
127
                    label: {
128
                        normal: {
129
                            show: true,
130
                            position: 'top'
131
                        }
132
                    },
133
                    lineStyle: {
134
                        normal: {
135
                            color: '#3E2723'
136
                        }
137
                    },
138
                    areaStyle: {
139
                        normal: {
140
                            color: '#6D4C41'
141
                        }
142
                    },
143
                    data:[820, 932, 901, 934, 1290, 1330, 1320]
144
                }
145
            ]
146
        };
147
        if (option && typeof option === "object") {
148
            myChart.setOption(option, true);
149
            $window.on('debouncedresize',function() {
150
                myChart.resize()
151
            });
152
        }
153
    },
154
    chart_b: function() {
155
        var dom = document.getElementById("chart_b"),
156
            myChart = echarts.init(dom),
157
            app = {},
158
            geoCoordMap = {
159
            '上海': [121.4648,31.2891],
160
            '东莞': [113.8953,22.901],
161
            '东营': [118.7073,37.5513],
162
            '中山': [113.4229,22.478],
163
            '临汾': [111.4783,36.1615],
164
            '临沂': [118.3118,35.2936],
165
            '丹东': [124.541,40.4242],
166
            '丽水': [119.5642,28.1854],
167
            '乌鲁木齐': [87.9236,43.5883],
168
            '佛山': [112.8955,23.1097],
169
            '保定': [115.0488,39.0948],
170
            '兰州': [103.5901,36.3043],
171
            '包头': [110.3467,41.4899],
172
            '北京': [116.4551,40.2539],
173
            '北海': [109.314,21.6211],
174
            '南京': [118.8062,31.9208],
175
            '南宁': [108.479,23.1152],
176
            '南昌': [116.0046,28.6633],
177
            '南通': [121.1023,32.1625],
178
            '厦门': [118.1689,24.6478],
179
            '台州': [121.1353,28.6688],
180
            '合肥': [117.29,32.0581],
181
            '呼和浩特': [111.4124,40.4901],
182
            '咸阳': [108.4131,34.8706],
183
            '哈尔滨': [127.9688,45.368],
184
            '唐山': [118.4766,39.6826],
185
            '嘉兴': [120.9155,30.6354],
186
            '大同': [113.7854,39.8035],
187
            '大连': [122.2229,39.4409],
188
            '天津': [117.4219,39.4189],
189
            '太原': [112.3352,37.9413],
190
            '威海': [121.9482,37.1393],
191
            '宁波': [121.5967,29.6466],
192
            '宝鸡': [107.1826,34.3433],
193
            '宿迁': [118.5535,33.7775],
194
            '常州': [119.4543,31.5582],
195
            '广州': [113.5107,23.2196],
196
            '廊坊': [116.521,39.0509],
197
            '延安': [109.1052,36.4252],
198
            '张家口': [115.1477,40.8527],
199
            '徐州': [117.5208,34.3268],
200
            '德州': [116.6858,37.2107],
201
            '惠州': [114.6204,23.1647],
202
            '成都': [103.9526,30.7617],
203
            '扬州': [119.4653,32.8162],
204
            '承德': [117.5757,41.4075],
205
            '拉萨': [91.1865,30.1465],
206
            '无锡': [120.3442,31.5527],
207
            '日照': [119.2786,35.5023],
208
            '昆明': [102.9199,25.4663],
209
            '杭州': [119.5313,29.8773],
210
            '枣庄': [117.323,34.8926],
211
            '柳州': [109.3799,24.9774],
212
            '株洲': [113.5327,27.0319],
213
            '武汉': [114.3896,30.6628],
214
            '汕头': [117.1692,23.3405],
215
            '江门': [112.6318,22.1484],
216
            '沈阳': [123.1238,42.1216],
217
            '沧州': [116.8286,38.2104],
218
            '河源': [114.917,23.9722],
219
            '泉州': [118.3228,25.1147],
220
            '泰安': [117.0264,36.0516],
221
            '泰州': [120.0586,32.5525],
222
            '济南': [117.1582,36.8701],
223
            '济宁': [116.8286,35.3375],
224
            '海口': [110.3893,19.8516],
225
            '淄博': [118.0371,36.6064],
226
            '淮安': [118.927,33.4039],
227
            '深圳': [114.5435,22.5439],
228
            '清远': [112.9175,24.3292],
229
            '温州': [120.498,27.8119],
230
            '渭南': [109.7864,35.0299],
231
            '湖州': [119.8608,30.7782],
232
            '湘潭': [112.5439,27.7075],
233
            '滨州': [117.8174,37.4963],
234
            '潍坊': [119.0918,36.524],
235
            '烟台': [120.7397,37.5128],
236
            '玉溪': [101.9312,23.8898],
237
            '珠海': [113.7305,22.1155],
238
            '盐城': [120.2234,33.5577],
239
            '盘锦': [121.9482,41.0449],
240
            '石家庄': [114.4995,38.1006],
241
            '福州': [119.4543,25.9222],
242
            '秦皇岛': [119.2126,40.0232],
243
            '绍兴': [120.564,29.7565],
244
            '聊城': [115.9167,36.4032],
245
            '肇庆': [112.1265,23.5822],
246
            '舟山': [122.2559,30.2234],
247
            '苏州': [120.6519,31.3989],
248
            '莱芜': [117.6526,36.2714],
249
            '菏泽': [115.6201,35.2057],
250
            '营口': [122.4316,40.4297],
251
            '葫芦岛': [120.1575,40.578],
252
            '衡水': [115.8838,37.7161],
253
            '衢州': [118.6853,28.8666],
254
            '西宁': [101.4038,36.8207],
255
            '西安': [109.1162,34.2004],
256
            '贵阳': [106.6992,26.7682],
257
            '连云港': [119.1248,34.552],
258
            '邢台': [114.8071,37.2821],
259
            '邯郸': [114.4775,36.535],
260
            '郑州': [113.4668,34.6234],
261
            '鄂尔多斯': [108.9734,39.2487],
262
            '重庆': [107.7539,30.1904],
263
            '金华': [120.0037,29.1028],
264
            '铜川': [109.0393,35.1947],
265
            '银川': [106.3586,38.1775],
266
            '镇江': [119.4763,31.9702],
267
            '长春': [125.8154,44.2584],
268
            '长沙': [113.0823,28.2568],
269
            '长治': [112.8625,36.4746],
270
            '阳泉': [113.4778,38.0951],
271
            '青岛': [120.4651,36.3373],
272
            '韶关': [113.7964,24.7028]
273
        };
274

    
275
        var BJData = [
276
            [{name:'北京'}, {name:'上海',value:95}],
277
            [{name:'北京'}, {name:'广州',value:90}],
278
            [{name:'北京'}, {name:'大连',value:80}],
279
            [{name:'北京'}, {name:'南宁',value:70}],
280
            [{name:'北京'}, {name:'南昌',value:60}],
281
            [{name:'北京'}, {name:'拉萨',value:50}],
282
            [{name:'北京'}, {name:'长春',value:40}],
283
            [{name:'北京'}, {name:'包头',value:30}],
284
            [{name:'北京'}, {name:'重庆',value:20}],
285
            [{name:'北京'}, {name:'常州',value:10}]
286
        ],
287
        SHData = [
288
            [{name:'上海'},{name:'包头',value:95}],
289
            [{name:'上海'},{name:'昆明',value:90}],
290
            [{name:'上海'},{name:'广州',value:80}],
291
            [{name:'上海'},{name:'郑州',value:70}],
292
            [{name:'上海'},{name:'长春',value:60}],
293
            [{name:'上海'},{name:'重庆',value:50}],
294
            [{name:'上海'},{name:'长沙',value:40}],
295
            [{name:'上海'},{name:'北京',value:30}],
296
            [{name:'上海'},{name:'丹东',value:20}],
297
            [{name:'上海'},{name:'大连',value:10}]
298
        ],
299
        GZData = [
300
            [{name:'广州'},{name:'福州',value:95}],
301
            [{name:'广州'},{name:'太原',value:90}],
302
            [{name:'广州'},{name:'长春',value:80}],
303
            [{name:'广州'},{name:'重庆',value:70}],
304
            [{name:'广州'},{name:'西安',value:60}],
305
            [{name:'广州'},{name:'成都',value:50}],
306
            [{name:'广州'},{name:'常州',value:40}],
307
            [{name:'广州'},{name:'北京',value:30}],
308
            [{name:'广州'},{name:'北海',value:20}],
309
            [{name:'广州'},{name:'海口',value:10}]
310
        ];
311

    
312
        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';
313

    
314
        var convertData = function (data) {
315
            var res = [];
316
            for (var i = 0; i < data.length; i++) {
317
                var dataItem = data[i];
318
                var fromCoord = geoCoordMap[dataItem[0].name];
319
                var toCoord = geoCoordMap[dataItem[1].name];
320
                if (fromCoord && toCoord) {
321
                    res.push({
322
                        fromName: dataItem[0].name,
323
                        toName: dataItem[1].name,
324
                        coords: [fromCoord, toCoord]
325
                    });
326
                }
327
            }
328
            return res;
329
        };
330

    
331
        var color = ['#7CB342', '#FB8C00', '#039BE5'];
332
        var series = [];
333
        [['Beijing', BJData], ['Shanghai', SHData], ['Guangzhou', GZData]].forEach(function (item, i) {
334
            series.push({
335
                    name: item[0] + ' Top10',
336
                    type: 'lines',
337
                    zlevel: 1,
338
                    effect: {
339
                        show: true,
340
                        period: 6,
341
                        trailLength: 0.7,
342
                        color: '#fff',
343
                        symbolSize: 3
344
                    },
345
                    lineStyle: {
346
                        normal: {
347
                            color: color[i],
348
                            width: 0,
349
                            curveness: 0.2
350
                        }
351
                    },
352
                    data: convertData(item[1])
353
                },
354
                {
355
                    name: item[0] + ' Top10',
356
                    type: 'lines',
357
                    zlevel: 2,
358
                    symbol: ['none', 'arrow'],
359
                    symbolSize: 10,
360
                    effect: {
361
                        show: true,
362
                        period: 6,
363
                        trailLength: 0,
364
                        symbol: planePath,
365
                        symbolSize: 15
366
                    },
367
                    lineStyle: {
368
                        normal: {
369
                            color: color[i],
370
                            width: 1,
371
                            opacity: 0.6,
372
                            curveness: 0.2
373
                        }
374
                    },
375
                    data: convertData(item[1])
376
                },
377
                {
378
                    name: item[0] + ' Top10',
379
                    type: 'effectScatter',
380
                    coordinateSystem: 'geo',
381
                    zlevel: 2,
382
                    rippleEffect: {
383
                        brushType: 'stroke'
384
                    },
385
                    label: {
386
                        normal: {
387
                            show: true,
388
                            position: 'right',
389
                            formatter: '{b}'
390
                        }
391
                    },
392
                    symbolSize: function (val) {
393
                        return val[2] / 8;
394
                    },
395
                    itemStyle: {
396
                        normal: {
397
                            color: color[i]
398
                        }
399
                    },
400
                    data: item[1].map(function (dataItem) {
401
                        return {
402
                            name: dataItem[1].name,
403
                            value: geoCoordMap[dataItem[1].name].concat([dataItem[1].value])
404
                        };
405
                    })
406
                });
407
        });
408

    
409
        var option = {
410
            backgroundColor: '#404a59',
411
            title : {
412
                text: 'Simulated migration',
413
                subtext: 'The data is fictitious',
414
                left: 'center',
415
                top: 20,
416
                textStyle : {
417
                    color: '#fff'
418
                }
419
            },
420
            tooltip : {
421
                trigger: 'item'
422
            },
423
            legend: {
424
                orient: 'vertical',
425
                bottom: 10,
426
                right: 10,
427
                data:['Beijing Top10', 'Shanghai Top10', 'Guangzhou Top10'],
428
                textStyle: {
429
                    color: '#fff'
430
                },
431
                selectedMode: 'single'
432
            },
433
            geo: {
434
                map: 'china',
435
                label: {
436
                    emphasis: {
437
                        show: false
438
                    }
439
                },
440
                roam: true,
441
                itemStyle: {
442
                    normal: {
443
                        areaColor: '#323c48',
444
                        borderColor: '#404a59'
445
                    },
446
                    emphasis: {
447
                        areaColor: '#2a333d'
448
                    }
449
                }
450
            },
451
            series: series
452
        };
453
        if (option && typeof option === "object") {
454
            myChart.setOption(option, true);
455
            $window.on('debouncedresize',function() {
456
                myChart.resize()
457
            });
458
        }
459
    },
460
    chart_c: function() {
461
        var dom = document.getElementById("chart_c"),
462
            myChart = echarts.init(dom),
463
            app = {},
464
            dataAxis = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''],
465
            data = [220, 182, 191, 234, 290, 330, 310, 123, 442, 321, 90, 149, 210, 122, 133, 334, 198, 123, 125, 220],
466
            yMax = 500,
467
            dataShadow = [];
468

    
469
        for (var i = 0; i < data.length; i++) {
470
            dataShadow.push(yMax);
471
        }
472

    
473
        var option = {
474
            title: {
475
                text: 'Feature Sample',
476
                subtext: 'Gradient Color, Shadow, Click Zoom'
477
            },
478
            xAxis: {
479
                data: dataAxis,
480
                axisLabel: {
481
                    inside: true,
482
                    textStyle: {
483
                        color: '#fff'
484
                    }
485
                },
486
                axisTick: {
487
                    show: false
488
                },
489
                axisLine: {
490
                    show: false
491
                },
492
                z: 10
493
            },
494
            yAxis: {
495
                axisLine: {
496
                    show: false
497
                },
498
                axisTick: {
499
                    show: false
500
                },
501
                axisLabel: {
502
                    textStyle: {
503
                        color: '#999'
504
                    }
505
                }
506
            },
507
            dataZoom: [
508
                {
509
                    type: 'inside'
510
                }
511
            ],
512
            series: [
513
                { // For shadow
514
                    type: 'bar',
515
                    itemStyle: {
516
                        normal: {color: 'rgba(0,0,0,0.05)'}
517
                    },
518
                    barGap:'-100%',
519
                    barCategoryGap:'40%',
520
                    data: dataShadow,
521
                    animation: false
522
                },
523
                {
524
                    type: 'bar',
525
                    itemStyle: {
526
                        normal: {
527
                            color: new echarts.graphic.LinearGradient(
528
                                0, 0, 0, 1,
529
                                [
530
                                    {offset: 0, color: '#F44336'},
531
                                    {offset: 0.5, color: '#F44336'},
532
                                    {offset: 1, color: '#E53935'}
533
                                ]
534
                            )
535
                        },
536
                        emphasis: {
537
                            color: new echarts.graphic.LinearGradient(
538
                                0, 0, 0, 1,
539
                                [
540
                                    {offset: 0, color: '#C62828'},
541
                                    {offset: 0.7, color: '#C62828'},
542
                                    {offset: 1, color: '#B71C1C'}
543
                                ]
544
                            )
545
                        }
546
                    },
547
                    data: data
548
                }
549
            ]
550
        };
551
        // Enable data zoom when user click bar.
552
        var zoomSize = 6;
553
        myChart.on('click', function (params) {
554
            console.log(dataAxis[Math.max(params.dataIndex - zoomSize / 2, 0)]);
555
            myChart.dispatchAction({
556
                type: 'dataZoom',
557
                startValue: dataAxis[Math.max(params.dataIndex - zoomSize / 2, 0)],
558
                endValue: dataAxis[Math.min(params.dataIndex + zoomSize / 2, data.length - 1)]
559
            });
560
        });
561
        if (option && typeof option === "object") {
562
            myChart.setOption(option, true);
563
            $window.on('debouncedresize',function() {
564
                myChart.resize()
565
            });
566
        }
567
    },
568
    chart_d: function() {
569
        var dom = document.getElementById("chart_d"),
570
            myChart = echarts.init(dom),
571
            app = {},
572
            base = +new Date(1968, 9, 3),
573
            oneDay = 24 * 3600 * 1000,
574
            date = [],
575
            data = [Math.random() * 300];
576

    
577
        for (var i = 1; i < 20000; i++) {
578
            var now = new Date(base += oneDay);
579
            date.push([now.getFullYear(), now.getMonth() + 1, now.getDate()].join('/'));
580
            data.push(Math.round((Math.random() - 0.5) * 20 + data[i - 1]));
581
        }
582

    
583
        var option = {
584
            tooltip: {
585
                trigger: 'axis',
586
                position: function (pt) {
587
                    return [pt[0], '10%'];
588
                }
589
            },
590
            title: {
591
                left: '0',
592
                text: 'Large dataset'
593
            },
594
            toolbox: {
595
                right: 30,
596
                feature: {
597
                    dataZoom: {
598
                        yAxisIndex: 'none',
599
                        title: {
600
                            zoom: 'zoom',
601
                            back: 'back'
602
                        }
603
                    },
604
                    restore: {
605
                        title: 'restore'
606
                    },
607
                    saveAsImage: {
608
                        title: 'save as image'
609
                    }
610
                }
611
            },
612
            xAxis: {
613
                type: 'category',
614
                boundaryGap: false,
615
                data: date
616
            },
617
            yAxis: {
618
                type: 'value',
619
                boundaryGap: [0, '100%']
620
            },
621
            dataZoom: [{
622
                type: 'inside',
623
                start: 0,
624
                end: 10
625
            }, {
626
                start: 0,
627
                end: 10,
628
                handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
629
                handleSize: '80%',
630
                handleStyle: {
631
                    color: '#fff',
632
                    shadowBlur: 3,
633
                    shadowColor: 'rgba(0, 0, 0, 0.6)',
634
                    shadowOffsetX: 2,
635
                    shadowOffsetY: 2
636
                }
637
            }],
638
            series: [
639
                {
640
                    name: 'Data',
641
                    type: 'line',
642
                    smooth: true,
643
                    symbol: 'none',
644
                    sampling: 'average',
645
                    itemStyle: {
646
                        normal: {
647
                            color: '#00838F'
648
                        }
649
                    },
650
                    areaStyle: {
651
                        normal: {
652
                            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
653
                                offset: 0,
654
                                color: '#0097A7'
655
                            }, {
656
                                offset: 1,
657
                                color: '#80DEEA'
658
                            }])
659
                        }
660
                    },
661
                    data: data
662
                }
663
            ]
664
        };
665
        if (option && typeof option === "object") {
666
            myChart.setOption(option, true);
667
            $window.on('debouncedresize',function() {
668
                myChart.resize()
669
            });
670
        }
671

    
672
    },
673
    chart_e: function() {
674
        var dom = document.getElementById("chart_e"),
675
            myChart = echarts.init(dom),
676
            app = {};
677

    
678
        var option = {
679
            title: {
680
                text: 'Funnel',
681
                subtext: 'fictitious data',
682
                left: 'left',
683
                top: 'bottom'
684
            },
685
            tooltip: {
686
                trigger: 'item',
687
                formatter: "{a} <br/>{b} : {c}%"
688
            },
689
            toolbox: {
690
                orient: 'vertical',
691
                top: 'center',
692
                right: 30,
693
                feature: {
694
                    dataView: {
695
                        readOnly: false,
696
                        title: 'dataview',
697
                        lang: ['Data View','Close','Refresh']
698
                    },
699
                    restore: {
700
                        title: 'restore'
701
                    },
702
                    saveAsImage: {
703
                        title: 'save as image'
704
                    }
705
                }
706
            },
707
            color: ['#039BE5','#00897B','#C0CA33','#546E7A','#D81B60'],
708
            legend: {
709
                orient: 'vertical',
710
                left: 'left',
711
                data: ['Show', 'Click', 'Visit', 'Consult', 'Order']
712
            },
713
            calculable: true,
714
            series: [
715
                {
716
                    name: 'funnel',
717
                    type: 'funnel',
718
                    width: '40%',
719
                    height: '45%',
720
                    left: '5%',
721
                    top: '50%',
722
                    data:[
723
                        {value: 60, name:'Show'},
724
                        {value: 30, name:'Click'},
725
                        {value: 10, name:'Visit'},
726
                        {value: 80, name:'Consult'},
727
                        {value: 100, name:'Order'}
728
                    ]
729
                },
730
                {
731
                    name: 'pyramid',
732
                    type: 'funnel',
733
                    width: '40%',
734
                    height: '45%',
735
                    left: '5%',
736
                    top: '5%',
737
                    sort: 'ascending',
738
                    data:[
739
                        {value: 60, name:'Show'},
740
                        {value: 30, name:'Click'},
741
                        {value: 10, name:'Visit'},
742
                        {value: 80, name:'Consult'},
743
                        {value: 100, name:'Order'}
744
                    ]
745
                },
746
                {
747
                    name: 'funnel',
748
                    type: 'funnel',
749
                    width: '40%',
750
                    height: '45%',
751
                    left: '55%',
752
                    top: '5%',
753
                    label: {
754
                        normal: {
755
                            position: 'left'
756
                        }
757
                    },
758
                    data:[
759
                        {value: 60, name: 'Show'},
760
                        {value: 30, name: 'Click'},
761
                        {value: 10, name: 'Visit'},
762
                        {value: 80, name: 'Consult'},
763
                        {value: 100, name: 'Order'}
764
                    ]
765
                },
766
                {
767
                    name: 'pyramid',
768
                    type: 'funnel',
769
                    width: '40%',
770
                    height: '45%',
771
                    left: '55%',
772
                    top: '50%',
773
                    sort: 'ascending',
774
                    label: {
775
                        normal: {
776
                            position: 'left'
777
                        }
778
                    },
779
                    data:[
780
                        {value: 60, name: 'Show'},
781
                        {value: 30, name: 'Click'},
782
                        {value: 10, name: 'Visit'},
783
                        {value: 80, name: 'Consult'},
784
                        {value: 100, name: 'Order'}
785
                    ]
786
                }
787
            ]
788
        };
789
        if (option && typeof option === "object") {
790
            myChart.setOption(option, true);
791
            $window.on('debouncedresize',function() {
792
                myChart.resize()
793
            });
794
        }
795
    }
796
};
(77-77/114)