Zzhangxiaohuiupdate
b5a4ce28创建于 2021年4月14日历史提交
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link rel="stylesheet" type="text/css" href="../themes/css/global_n.css" />
<link rel="stylesheet" type="text/css" href="../themes/css/iframe.css" />
<script src="../js/echarts/echarts.js"></script>
 <script src="../data/dataFGF.js"></script>
</head>
<body>
 <div style="width:750px;height:100%;" id="main"> </div>
        <script>
		 require.config({
				paths: {
					echarts: '../js/echarts'
				}
			});
		 require(
			[
				'echarts',
				'echarts/chart/pie',
				'echarts/chart/bar',
				'echarts/chart/map',
				'echarts/chart/line'
			],
			function (ec) {
                var myChart = ec.init(document.getElementById('main'));
                var mapType = [
                    'china',
                    // 23个省
                    '广东', '青海', '四川', '海南', '陕西',
                    '甘肃', '云南', '湖南', '湖北', '黑龙江',
                    '贵州', '山东', '江西', '河南', '河北',
                    '山西', '安徽', '福建', '浙江', '江苏',
                    '吉林', '辽宁', '台湾',
                    // 5个自治区
                    '新疆', '广西', '宁夏', '内蒙古', '西藏',
                    // 4个直辖市
                    '北京', '天津', '上海', '重庆',
                    // 2个特别行政区
                    '香港', '澳门'
                ];
              var  option =   {
                          tooltip: {
                              'trigger': 'item',
                              showContent:true
                          },
                            legend: {
                                orient: 'vertical',
                                selectedMode:'single',
                                x:'left',
                                textStyle:{
                                    color:'#FFF'
                                },
                                selected: {
                                    '审批类项目' : true,
                                    '核准类项目':false,
                                    '备案类项目':false
                                },
                                data:['审批类项目','核准类项目','备案类项目']
                            },
                            dataRange: {
                                min: 0,
                                max: 5000,
                                text: ['高', '低'],           // 文本,默认为数值文本
                                calculable: true,
                                x: 'left',
                                y2: 50,
                                color: ['orangered', 'yellow', 'lightskyblue'],
                                textStyle: {
                                    "color": "#fff"
                                }
                            },
                            series: [
                                {
                                    seriesIndex: 0,
                                    'name': '审批类项目',
                                    'type': 'map',
                                     mapType: 'china',
                                     selectedMode : 'single',
                                    tooltip: {
                                        show:true,
                                        'trigger': 'item',
                                        formatter: '{b} {a} {c} 万元'
                                    },
                                    'mapLocation': {
                                        "y": "top",
                                        "height": "85%"
                                    },
                                    'data': FGF_DATA.approvalData // 审核
                                },
                                {
                                    seriesIndex: 1,
                                    'name': '核准类项目',
                                    'type': 'map',
                                    mapType: 'china',
                                    selectedMode : 'single',
                                    tooltip: {
                                        'trigger': 'item',
                                        showContent:true,
                                        formatter: '{b} {a} {c} 万元'
                                    },
                                        'mapLocation': {
                                        "y": "top",
                                        "height": "85%"
                                    },
                                    'data': FGF_DATA.authorizeData // 核准类项目
                                },
                                {
                                    seriesIndex: 2,
                                    'name': '备案类项目',
                                    'type': 'map',
                                    mapType: 'china',
                                    selectedMode : 'single',
                                    tooltip: {
                                        'trigger': 'item',
                                        showContent:true,
                                        formatter: '{b} {a} {c} 万元'
                                    },
                                    'mapLocation': {
                                        "y": "top",
                                        "height": "85%"
                                    },
                                    'data':FGF_DATA.recordData
                                }
                            ]
                };
                myChart.setOption(option, true);
//                // 定义初始变量
//                var ecConfig = require('echarts/config');
//                var curIndx = 0;
//                // 绑定事件 地图选择事件
//                myChart.on(ecConfig.EVENT.MAP_SELECTED, function (param) {
//                        var len = mapType.length;
//                        var mt = mapType[curIndx % len];
//                        if (mt == 'china') {
//                            // 全国选择时指定到选中的省份
//                            var selected = param.selected;
//                            for (var i in selected) {
//                                if (selected[i]) {
//                                    mt = i;
//                                    while (len--) {
//                                        if (mapType[len] == mt) {
//                                            curIndx = len;
//                                        }
//                                    }
//                                    break;
//                                }
//                            }
//                        }
//                        else {
//                            curIndx = 0;
//                            mt = 'china';
//                        }
//                    // var obj= myChart.component.legend.getSelectedMap();
//                        option.series[0].mapType=mt;
//                        option.series[1].mapType=mt;
//                        option.series[2].mapType=mt;
//                        myChart.setOption(option, true);
//                });
            });
		 </script>
</body>
</html>