2
schangxiang@126.com
2024-08-16 b47c50a2a514def7374b32d7194b2c599cba5625
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
function option3 (name) {
    var option = {
        title : {
            text: 'GDP',
            subtext: '数据来自国家统计局',
            x:'right',
            textStyle:{}
        },
        tooltip : {
            trigger: 'item'
        },
        dataRange: {
            min: 0,
            max : dataMap['dataA' + name][2011 + 'max'],
            text:['高','低'],           // 文本,默认为数值文本
            calculable : true,
            x: 'left'
        },
        series : [
            {
                type: 'map',
                mapType: 'china',
                mapLocation: {
                    y: 'top',
                    height : 340
                },
                itemStyle:{
                    normal:{label:{show:true}}
                }
            }
        ]
    };
    
    option.title.text = '人均' + eNameMap[name];
    var color = eColorMap[name];
    option.title.textStyle.color = color;
    option.dataRange.color = [
        color, 
        require('zrender/tool/color').lift(color, -0.9)
    ];
    // console.log(option.dataRange.color,name)
    
    var timelineOption = {
        timeline : {
            data : (function(){
                var a = [];
                for (var i = 2002; i <= 2011; i++) {
                    a.push(i + '-01-01');
                }
                return a;
            })(),
            label : {
                formatter : function(s) {
                    return s.slice(0, 4);
                }
            },
            playInterval : 1000
        },
        options : []
    };
    
    var curYear = 2002;
    option.series[0].name = '人均' + eNameMap[name] + '(' + curYear + ')';
    option.series[0].data =  dataMap['dataA' + name][curYear]
    
    timelineOption.options.push(option);
    for (curYear = 2003; curYear <= 2011; curYear++) {
        var newSeries = {
                type: 'map',
                mapType: 'china',
                itemStyle:{
                    normal:{label:{show:true}}
                }
            };
        newSeries.name = '人均' + eNameMap[name] + '(' + curYear + ')';
        newSeries.data =  dataMap['dataA' + name][curYear]
        timelineOption.options.push({
            series : [newSeries]
        })
    }
    return timelineOption;
}