diff --git a/js/lib/handan.json b/js/pagejs/handan.json index f1e2444..f1e2444 100755 --- a/js/lib/handan.json +++ b/js/pagejs/handan.json diff --git a/js/pagejs/index.js b/js/pagejs/index.js index d651edb..8b86d26 100644 --- a/js/pagejs/index.js +++ b/js/pagejs/index.js @@ -16,151 +16,153 @@ var displayCountry = []; //赤峰的省市区县 function ChiFengMapSeries(name){ - var obj = { + $.get('./../js/pagejs/handan.json', function (yCjson) { + echarts.registerMap('邯郸', yCjson); + var obj = { - // center:[118.361313,42.27018],//中心点 - zoom:1.2,//当前视角的缩放比例。 - // roam:'scale',//是否支持鼠标缩放 - //selectedMode:true,//选中模式,表示是否支持多个选中,默认关闭 - name:name, - type:'map', - map:'邯郸', - - // markPoint:{ - // symbol:'circle' - // }, - label: { - normal: { - show: true - }, - emphasis: { - show: true, - } - }, - mapLocation:{ - y:60 - }, - itemStyle: { - normal: { - borderWidth: 1, - borderColor: 'rgba(147,191,245,.3)', - - label: { - show: false, - textStyle: { - color: "#fff" - } - } - }, - emphasis:{ - areaColor: 'rgba(255,204,0,0.4)', - label: { - show: false, - textStyle: { - color: "#fff" - } - } - } - }, - markPoint:{ - symbol:'image://./../img/cf_map_icon.png', - silent:true, - symbolSize:[17, 17], - data: [ + // center:[118.361313,42.27018],//中心点 + zoom: 1.2,//当前视角的缩放比例。 + // roam:'scale',//是否支持鼠标缩放 + //selectedMode:true,//选中模式,表示是否支持多个选中,默认关闭 + name: name, + type: 'map', + map: '邯郸', - { - name: '', - coord: [103.729882,30.136356], + // markPoint:{ + // symbol:'circle' + // }, + label: { + normal: { + show: true + }, + emphasis: { + show: true, + } + }, + mapLocation: { + y: 60 + }, + itemStyle: { + normal: { + borderWidth: 1, + borderColor: 'rgba(147,191,245,.3)', + + label: { + show: false, + textStyle: { + color: "#fff" + } + } }, + emphasis: { + areaColor: 'rgba(255,204,0,0.4)', + label: { + show: false, + textStyle: { + color: "#fff" + } + } + } + }, + markPoint: { + symbol: 'image://./../img/cf_map_icon.png', + silent: true, + symbolSize: [17, 17], + data: [ + + { + name: '', + coord: [103.729882, 30.136356], + }, + { + name: '', + coord: [103.789673, 30.268198], + }, + { + name: '', + coord: [103.806921, 29.789424], + }, + { + name: '', + coord: [104.164518, 30.059866], + }, + { + name: '', + coord: [103.383783, 30.04186], + }, + { + name: '', + coord: [103.26535, 29.914721], + }, + + ], + label: { + normal: { + show: false, + }, + emphasis: { + show: false, + }, + + } + }, + + data: [ { - name: '', - coord: [103.789673,30.268198], + name: '峰峰矿区', + value: 0, + }, { - name: '', - coord: [103.806921,29.789424], + name: '彭山区', + value: 0 }, { - name: '', - coord: [104.164518,30.059866], + name: '青神县', + value: 0 }, { - name: '', - coord: [103.383783,30.04186], + name: '仁寿县', + value: 0 }, { - name: '', - coord: [103.26535,29.914721], + name: '丹棱县', + value: 0 }, - + { + name: '洪雅县', + value: 0 + } ], - label:{ - normal:{ - show:false, - }, - emphasis:{ - show:false, - }, - - } - }, - data:[ - { - name:'峰峰矿区', - value:0, - }, - { - name:'彭山区', - value:0 - }, - { - name:'青神县', - value:0 - }, - { - name:'仁寿县', - value:0 - }, - { - name:'丹棱县', - value:0 - }, - { - name:'洪雅县', - value:0 - } - ], - - - }; - return obj; - + }; + return obj; + }); }; var map_c_option = { tooltip: { trigger: 'item', - formatter: function(params) { - var res = params.name+'
'; - var myseries = map_c_option.series; - for (var i = 0; i < myseries.length; i++) { - - var displayVal = 0; - for(var j=0;j'; - } - } - return res; - } + // formatter: function(params) { + // var res = params.name+'
'; + // var myseries = map_c_option.series; + // for (var i = 0; i < myseries.length; i++) { + // + // var displayVal = 0; + // for(var j=0;j'; + // } + // } + // return res; + // } }, // dataRange:{ @@ -297,80 +299,49 @@ //左中柱图bar_l_echart //中间地图 - map_c_echart.setOption(map_c_option,true); - // map_c_echart.mapselected({ - // - // }); - currentIndex = -1; - var dataLen = map_c_option.series[0].data.length; - // 取消之前高亮的图形 - map_c_echart.dispatchAction({ - type: 'downplay', - seriesIndex: 0, - dataIndex: currentIndex - }); - currentIndex = (currentIndex + 1) % dataLen; - // 高亮当前图形 - map_c_echart.dispatchAction({ - type: 'highlight', - seriesIndex: 0, - dataIndex:currentIndex - }); - // 显示 tooltip - map_c_echart.dispatchAction({ - type: 'showTip', - seriesIndex: 0, - dataIndex: currentIndex + $.getJSON('./../js/pagejs/handan.json', function (yCjson) { + echarts.registerMap('银川', yCjson); + var chart = echarts.init(document.getElementById('map_c_echart')); + + option = { + + dataRange:{ + min:0, + max:500, + text:['高','低'], + realtime:true, + calculable:true, + color:['orangered','yellow','green'] + }, + series:[ + { + name:'犯罪数量', + type:'map', + map:'银川', + mapLocation:{ + y:60 + }, + itemSytle:{ + emphasis:{label:{show:false}} + }, + data:[ + {name:'西夏区',value:Math.round(Math.random()*500)}, + {name:'贺兰县',value:Math.round(Math.random()*500)}, + {name:'金凤区',value:Math.round(Math.random()*500)}, + {name:'永宁县',value:Math.round(Math.random()*500)}, + {name:'灵武市',value:Math.round(Math.random()*500)}, + {name:'兴庆区',value:Math.round(Math.random()*500)} + ] + } + ], + + }; + chart.setOption(option); }); - // setTimeout(function () { - // currentIndex = -1; - // var dataLen = map_c_option.series[0].data.length; - // // 取消之前高亮的图形 - // map_c_echart.dispatchAction({ - // type: 'downplay', - // seriesIndex: 0, - // dataIndex: currentIndex - // }); - // currentIndex = (currentIndex + 1) % dataLen; - // // 高亮当前图形 - // map_c_echart.dispatchAction({ - // type: 'highlight', - // seriesIndex: 0, - // dataIndex:currentIndex - // }); - // // 显示 tooltip - // map_c_echart.dispatchAction({ - // type: 'showTip', - // seriesIndex: 0, - // dataIndex: currentIndex - // }); - // },1000); - // setInterval(function () { - // var dataLen = map_c_option.series[0].data.length; - // // 取消之前高亮的图形 - // myChart.dispatchAction({ - // type: 'downplay', - // seriesIndex: 0, - // dataIndex: currentIndex - // }); - // currentIndex = (currentIndex + 1) % dataLen; - // // 高亮当前图形 - // myChart.dispatchAction({ - // type: 'highlight', - // seriesIndex: 0, - // dataIndex:currentIndex - // }); - // // 显示 tooltip - // myChart.dispatchAction({ - // type: 'showTip', - // seriesIndex: 0, - // dataIndex: currentIndex - // }); - // }, 1000); - - //右上线上线下排行榜图 + + //右上线上线下排行榜图 var bar_r_option = { // tooltip : { // trigger: 'axis', @@ -971,16 +942,16 @@ var seriesBerthData=new ChiFengMapSeries("停车位数"); //停车场 var seriesParkData=new ChiFengMapSeries("停车场数"); - for (var i = 0; i < seriesBerthData.data.length; i++) { - var name = seriesBerthData.data[i].name; - //获取该区停车场个数 - seriesParkData.data[i].value=pkVo[name]==null?0:pkVo[name]; - //获取该区的停车位个数 - seriesBerthData.data[i].value=berthsVo[name]==null?0:berthsVo[name]; - } - map_c_option.series[0] = seriesParkData; - map_c_option.series[1] = seriesBerthData; - map_c_echart.setOption(map_c_option); + // for (var i = 0; i < seriesBerthData.data.length; i++) { + // var name = seriesBerthData.data[i].name; + // //获取该区停车场个数 + // seriesParkData.data[i].value=pkVo[name]==null?0:pkVo[name]; + // //获取该区的停车位个数 + // seriesBerthData.data[i].value=berthsVo[name]==null?0:berthsVo[name]; + // } + // map_c_option.series[0] = seriesParkData; + // map_c_option.series[1] = seriesBerthData; + // map_c_echart.setOption(map_c_option); }else{ @@ -1062,14 +1033,14 @@ //中间地图 //空闲停车位 - var seriesBerthData=new ChiFengMapSeries("空闲车位数"); - for (var i = 0; i < seriesBerthData.data.length; i++) { - var name = seriesBerthData.data[i].name; - //获取该区的停车位个数 - seriesBerthData.data[i].value=berthsVo[name]==null?0:berthsVo[name]; - } - map_c_option.series[2] = seriesBerthData; - map_c_echart.setOption(map_c_option); + // var seriesBerthData=new ChiFengMapSeries("空闲车位数"); + // for (var i = 0; i < seriesBerthData.data.length; i++) { + // var name = seriesBerthData.data[i].name; + // //获取该区的停车位个数 + // seriesBerthData.data[i].value=berthsVo[name]==null?0:berthsVo[name]; + // } + // map_c_option.series[2] = seriesBerthData; + // map_c_echart.setOption(map_c_option); }else{