echarts3的简单实践(饼图、柱形图、折线图、地图+散点图)
echarts3是向下兼容echarts2的,所以echarts2切换到echarts3基本无需改代码。
饼图、柱形图、折线图:用的echarts2的配置项,但是能正常显示
代码片段:
- function loadCharts(orgCode){
- /** 构建故障原因饼图 */
- myChart1.showLoading();
- jQuery.ajax({
- type: "POST",
- url: "#URL()/fastrepair/statistics/queryDayFaultReason",
- data: {orgCode:orgCode},
- success: function(json){
- var faultReason = json.result;
- option1 = {
- title : {
- text: '主要故障原因',
- x:'center',
- y:'bottom',
- textStyle: {
- fontFamily: 'Microsoft YaHei',
- fontSize:12,
- fontStyle: 'normal',
- fontWeight: 'normal',
- color: '#333333'
- }
- },
- tooltip : {
- trigger: 'item',
- formatter: "{a} <br/>{b} : {c} ({d}%)"
- },
- calculable : true,
- color: ['rgb(27,208,220)','rgb(106,234,157)','rgb(109,174,239)','rgb(240,208,113)','rgb(235,97,0)'],
- series : [
- {
- name:'主要故障原因',
- clickable:false,
- itemStyle: {
- normal: {
- label: {
- formatter: "{b} {c}"
- },
- labelLine: {
- length: 5
- }
- }
- },
- type:'pie',
- radius : '55%',
- center: ['50%', '40%'],
- data: faultReason
- }
- ]
- };
- myChart1.setOption(option1);
- myChart1.hideLoading();
- }
- });
- /** 构建故障类型饼图 */
- myChart2.showLoading();
- jQuery.ajax({
- type: "POST",
- url: "#URL()/fastrepair/statistics/queryDayFaultType",
- data: {orgCode:orgCode},
- success: function(json){
- var faultType = json.result;
- option2 = {
- title : {
- text: '故障类型',
- x:'center',
- y:'bottom',
- textStyle: {
- fontFamily: 'Microsoft YaHei',
- fontSize:12,
- fontStyle: 'normal',
- fontWeight: 'normal',
- color: '#333333'
- }
- },
- tooltip : {
- trigger: 'item',
- formatter: "{a} <br/>{b} : {c} ({d}%)"
- },
- calculable : true,
- color: ['rgb(27,208,220)','rgb(109,174,239)','rgb(240,208,113)','rgb(235,97,0)'],
- series : [
- {
- type:'pie',
- name:'故障类型',
- clickable:false,
- itemStyle: {
- normal: {
- label: {
- formatter: "{b} {c}"
- },
- labelLine: {
- length: 5
- }
- }
- },
- radius : '55%',
- center: ['50%', '40%'],
- data:faultType
- }
- ]
- };
- myChart2.setOption(option2);
- myChart2.hideLoading();
- }
- });
- /** 构建故障来源饼图 */
- myChart3.showLoading();
- jQuery.ajax({
- type: "POST",
- url: "#URL()/fastrepair/statistics/queryDayFaultSource",
- data: {orgCode:orgCode},
- success: function(json){
- var faultSource = json.result;
- option3 = {
- title : {
- text: '故障来源',
- x:'center',
- y:'bottom',
- textStyle: {
- fontFamily: 'Microsoft YaHei',
- fontSize:12,
- fontStyle: 'normal',
- fontWeight: 'normal',
- color: '#333333'
- }
- },
- tooltip : {
- trigger: 'item',
- formatter: "{a} <br/>{b} : {c} ({d}%)"
- },
- calculable : true,
- color: ['rgb(27,208,220)','rgb(109,174,239)','rgb(240,208,113)'],
- series : [
- {
- name:'故障来源',
- clickable:false,
- itemStyle: {
- normal: {
- label: {
- formatter: "{b} {c}"
- },
- labelLine: {
- length: 5
- }
- }
- },
- type:'pie',
- radius : '55%',
- center: ['50%', '40%'],
- data:faultSource
- }
- ]
- };
- myChart3.setOption(option3);
- myChart3.hideLoading();
- }
- });
- myChart4.showLoading();
- jQuery.ajax({
- type: "POST",
- url: "#URL()/fastrepair/statistics/queryDayFaultUnit",
- data: {orgCode:orgCode},
- success: function(json){
- var faultUnit = json.result;
- var orgname =[];
- var daytotal = [];
- var dayrushrepair =[];
- var dayrecover = [];
- jQuery.each(faultUnit, function(i,item){
- orgname.push(item.orgname);
- daytotal.push(item.daytotal);
- dayrushrepair.push(item.dayrushrepair);
- dayrecover.push(item.dayrecover);
- });
- option4 = {
- tooltip : {
- trigger: 'item'
- },
- legend: {
- //data:['历史未复电','当天抢修中','当天已复电'],
- data:['当天抢修中','当天已复电','当天总数'],
- y:'bottom',
- textStyle: {
- fontFamily:'Microsoft YaHei'
- }
- },
- grid:{
- x:50,
- x2:35,
- y:20,
- y2:80
- },
- xAxis : [
- {
- type : 'category',
- axisLine: {
- show: false
- },
- axisLabel: {
- textStyle: {
- color: '#333',
- fontFamily:'Microsoft YaHei'
- }
- },
- axisTick : {show: false},
- splitLine: {
- show: false
- },
- splitArea: {
- show: false
- },
- data : orgname
- }
- ],
- yAxis : [
- {
- type : 'value',
- axisLine: {
- show: false
- },
- axisLabel: {
- textStyle: {
- color: '#333',
- fontFamily:'Microsoft YaHei'
- }
- },
- axisTick : {show: false},
- splitLine: {
- show: true
- },
- splitArea: {
- show: false
- }
- }
- ],
- series : [
- /* {
- name:'历史未复电',
- type:'bar',
- data:[15, 8, 7, 16, 5, 7, 13],
- itemStyle: {
- normal: {
- color: '#6daeef'
- }
- },
- markLine : {
- symbol: 'none',
- precision: 1,
- itemStyle: {
- normal: {
- lineStyle: {
- type: 'dotted'
- }
- }
- },
- data : [
- {type : 'average', name: '平均值'}
- ]
- }
- },*/
- {
- name:'当天抢修中',
- type:'bar',
- data:dayrushrepair,
- itemStyle: {
- normal: {
- color: '#f0d071'
- }
- },
- markLine : {
- symbol: 'none',
- precision: 1,
- itemStyle: {
- normal: {
- lineStyle: {
- type: 'dotted'
- }
- }
- },
- data : [
- {type : 'average', name : '平均值'}
- ]
- }
- },
- {
- name:'当天已复电',
- type:'bar',
- data:dayrecover,
- itemStyle: {
- normal: {
- color: '#1bd0dc'
- }
- },
- markLine : {
- symbol: 'none',
- precision: 1,
- itemStyle: {
- normal: {
- lineStyle: {
- type: 'dotted'
- }
- }
- },
- data : [
- {type : 'average', name : '平均值'}
- ]
- }
- },
- {
- type:'line',
- name:'当天总数',
- yAxisIndex: 0,
- itemStyle: {
- normal: {
- color:'#0970d6'
- }
- },
- data:daytotal
- }
- /* {
- type:'line',
- name:'历史数据',
- yAxisIndex: 0,
- itemStyle: {
- normal: {
- color:'#f15acc'
- }
- },
- data:[25, 26, 27, 28, 29, 30, 36]
- }*/
- ]
- };
- myChart4.setOption(option4);
- myChart4.hideLoading();
- }
- });
- /** 构建故障持续时间柱形图 */
- myChart5.showLoading();
- jQuery.ajax({
- type: "POST",
- url: "#URL()/fastrepair/statistics/queryDayFaultTime",
- data: {orgCode:orgCode},
- success: function(json){
- var faultTime = json.result;
- var option5 = {
- grid:{
- x:50
- },
- xAxis : [
- {
- type : 'value',
- axisLine: {
- show: false
- },
- axisTick : {show: false},
- splitLine: {
- show: false
- },
- splitArea: {
- show: false
- }
- }
- ],
- yAxis : [
- {
- type : 'category',
- axisLine: {
- show: false
- },
- axisTick : {show: false},
- splitLine: {
- show: true
- },
- splitArea: {
- show: false
- },
- data : ['2h-4h','4h-8h','>8h']
- }
- ],
- series : [
- {
- name:'故障持续时间',
- type:'bar',
- data:faultTime,
- itemStyle: {
- normal: {
- color: '#1BD0DC',
- label : {
- show: true,
- position: 'insideRight',
- formatter: '{c}',
- textStyle: {
- color:'#FFF'
- }
- }
- }
- }
- }
- ]
- };
- myChart5.setOption(option5);
- myChart5.hideLoading();
- }
- });
- }
2.柱形图+折线图+地图+散点图,这是从echarts3重新开发的
代码片段:
- /** 加载图表 function
- * provinceCode 省编码
- * bureau_code 局编码
- * assetType 资产类型
- */
- var myChart = echarts.init(document.getElementById('main'));
- var myChart1 = echarts.init(document.getElementById('main1'));
- var myChart2 = echarts.init(document.getElementById('map'));
- var convertData = function (data) {
- var res = [];
- for (var i = 0; i < data.length; i++) {
- var geoCoord = geoCoordMap[data[i].name];
- if (geoCoord) {
- res.push({
- name: data[i].name,
- value: geoCoord.concat(data[i].value)
- });
- }
- }
- return res;
- };
- var geoCoordMap = {};
- function loadCharts(provinceCode,bureau_code,assetType){
- var tjnybm = cui("#censusDate").getValue();
- if(!provinceCode){ provinceCode = '00';}
- if(!assetType) { assetType = 0;}
- var assetTypeName ='';
- if(assetType == 0){
- assetTypeName ='变电站数量';
- }else if(assetType == 1){
- assetTypeName ='主变数量(台)';
- }else if(assetType == 2){
- assetTypeName ='主变容量(MVA)';
- }else if(assetType == 3){
- assetTypeName ='断路器数量(组)';
- }else if(assetType == 4){
- assetTypeName ='隔离开关数量(组)';
- }else if(assetType == 5){
- assetTypeName ='GIS间隔数量';
- }else if(assetType == 6){
- assetTypeName ='输电线路长度(km)';
- }else if(assetType == 7){
- assetTypeName ='输电线路条数';
- }else if(assetType == 8){
- assetTypeName ='配变数量(台)';
- }else if(assetType == 9){
- assetTypeName ='配变容量(KVA)';
- }else if(assetType == 10){
- assetTypeName ='10kV馈线长度(km)';
- }else if(assetType == 11){
- assetTypeName ='10kV馈线条数';
- }
- var orgCode = provinceCode;
- var orgName = cui("#parentUnit").getText();
- if(bureau_code){
- orgCode = bureau_code;
- orgName = cui("#childUnit").getText();
- }
- var param = [orgCode,tjnybm,assetType];
- /** echarts图表构建开始 */
- //构建资产规模分布
- myChart.showLoading();
- jQuery.ajax({
- type: "POST",
- url: "/web/assetmonitoring/assetScaleChart/queryAssetDistribution.bpms",
- data: {'param':param},
- traditional:true,
- async: true,
- dataType: 'json',
- success: function(data){
- var distributionList = data.distributionList;
- var dydj =[];
- var total = [];
- var add =[];
- jQuery.each(distributionList, function(i,item){
- dydj.push(item.dimName);
- total.push(item.assetTotal);
- add.push(item.assetNew);
- });
- option = {
- title: {
- text: ((assetTypeName.indexOf("(")!=-1?assetTypeName.substring(0,assetTypeName.indexOf("(")):assetTypeName)+'的资产规模分布'+assetTypeName.substring(assetTypeName.indexOf("("),assetTypeName.indexOf(")")+1))+'('+tjnybm.substr(0,4)+'年'+tjnybm.substr(4,2)+'月)',
- textStyle: {fontSize:14,fontWeight:'normal'},
- subtext:'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n'+orgName,
- subtextStyle: {
- color:'#000'
- },
- top:'top',
- left:'center'
- },
- // animation:false,
- grid:{
- left:60
- },
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'none'
- }
- },
- xAxis: [
- {
- type: 'category',
- data: dydj,
- axisTick: {
- alignWithLabel: true
- }
- }
- ],
- yAxis: [
- {
- name:'总数',
- type: 'value',
- splitNumber:4,
- axisLabel: {
- formatter: '{value} '
- }
- },
- {
- name:'新增',
- type: 'value',
- splitNumber:4,
- axisLabel: {
- formatter: '{value} '
- }
- }
- ],
- series: [
- {
- type:'bar',
- name:'总数',
- data:total,
- barWidth:'20%',
- itemStyle:{
- normal :{
- color:'#4F94CD'
- },
- emphasis: {
- color:'#4876FF'
- }
- }
- },
- {
- type:'line',
- name:'新增',
- yAxisIndex: 1,
- data:add,
- itemStyle: {
- normal: {color: '#188df0'}
- }
- }
- ]
- };
- myChart.setOption(option);
- myChart.hideLoading();
- }
- });
- //构建资产规模趋势
- myChart1.showLoading();
- jQuery.ajax({
- type: "POST",
- url: "/web/assetmonitoring/assetScaleChart/queryAssetTrend.bpms",
- data: {'param':param},
- traditional:true,
- async: true,
- dataType: 'json',
- success: function(data){
- var trendList = data.trendList;
- var tjnybm1 =[];
- var total = [];
- var add =[];
- jQuery.each(trendList, function(i,item){
- tjnybm1.push(item.tjnybm);
- total.push(item.assetTotal);
- add.push(item.assetNew);
- });
- option1 = {
- title: {
- text: ((assetTypeName.indexOf("(")!=-1?assetTypeName.substring(0,assetTypeName.indexOf("(")):assetTypeName)+'的资产规模趋势'+assetTypeName.substring(assetTypeName.indexOf("("),assetTypeName.indexOf(")")+1))+'('+tjnybm.substr(0,4)+'年'+tjnybm.substr(4,2)+'月)',
- textStyle: {fontSize:14,fontWeight:'normal'},
- subtext:'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n'+orgName,
- subtextStyle: {
- color:'#000'
- },
- top:'top',
- left:'center'
- },
- // animation:false,
- grid:{
- left:60
- },
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'none'
- }
- },
- xAxis: [
- {
- type: 'category',
- data: tjnybm1,
- axisTick: {
- alignWithLabel: true
- }
- }
- ],
- yAxis: [
- {
- name:'总数',
- type: 'value',
- splitNumber:4,
- axisLabel: {
- formatter: '{value} '
- }
- },
- {
- name:'新增',
- type: 'value',
- splitNumber:4,
- axisLabel: {
- formatter: '{value} '
- }
- }
- ],
- series: [
- {
- type:'bar',
- name:'总数',
- data:total,
- barWidth:'20%',
- itemStyle:{
- normal :{
- color:'#4F94CD'
- },
- emphasis: {
- color:'#4876FF'
- }
- }
- },
- {
- type:'line',
- name:'新增',
- yAxisIndex: 1,
- data:add,
- itemStyle: {
- normal: {color: '#188df0'}
- }
- }
- ]
- };
- myChart1.setOption(option1);
- myChart1.hideLoading();
- }
- });
- /** 构建对比分析地图 */
- if(bureau_code && bureau_code.length==2){
- provinceCode = bureau_code;
- }
- var param2 = [provinceCode,tjnybm,assetType];
- myChart2.showLoading();
- jQuery.ajax({
- type: "POST",
- url: "/web/assetmonitoring/assetScaleChart/queryAssetCompare.bpms",
- data: {'param':param2},
- traditional:true,
- async: true,
- dataType: 'json',
- success: function(result){
- var compareList = result.compareList;
- var data =[];
- jQuery.each(compareList, function(i,item){
- var objdata = {};
- objdata.name=item.dimName;
- objdata.value=item.assetTotal;
- data.push(objdata);
- });
- var mapJsonName;
- var mapJson = getMapJson(provinceCode);
- mapJsonName =mapJson[0].name;
- geoCoordMap =mapJson[1].geo;
- //加载地图
- option3 = {
- title: {
- text: ((assetTypeName.indexOf("(")!=-1?assetTypeName.substring(0,assetTypeName.indexOf("(")):assetTypeName)+'的单位对比分析'+assetTypeName.substring(assetTypeName.indexOf("("),assetTypeName.indexOf(")")+1))+'('+tjnybm.substr(0,4)+'年'+tjnybm.substr(4,2)+'月)',
- textStyle: {fontSize:18,fontWeight:'normal'},
- top:'top',
- left:'center'
- },
- // animation:false,
- tooltip : {
- trigger: 'item'
- },
- geo: {
- map: mapJsonName,
- selectedMode:'single',
- label: {
- normal: {
- show: false
- },
- emphasis: {
- show: false
- }
- },
- itemStyle: {
- normal: {
- areaColor: '#D1EEEE'
- },
- emphasis: {
- areaColor: '#6495ED'
- }
- }
- },
- series: [
- {
- type: 'scatter',
- coordinateSystem: 'geo',
- data: convertData(data),
- symbolSize: 20,
- hoverAnimation: true,
- symbolSize: function (val) {
- return (val[2] / (compareList[0].assetTotal) *100)> 30?(val[2] / (compareList[0].assetTotal) *250):(val[2] / (compareList[0].assetTotal) *300);
- },
- label: {
- normal: {
- formatter: function (params) {
- return params.name + '\n ' + params.value[2];
- },
- position: 'inside',
- show: true,
- textStyle:{color:'#000'}
- }
- },
- itemStyle: {
- normal: {
- color: '#5CACEE'
- },
- emphasis: {
- color: '#FF8C00'
- }
- },
- tooltip : {
- formatter: function (params) {
- return params.name + ' : ' + params.value[2];
- }
- },
- zlevel: 1
- },
- {
- type:'map',
- geoIndex:0,
- data: data,
- tooltip : {
- formatter: function (params) {
- return params.name + (isNaN(params.value)?'':(':'+params.value));
- }
- }
- },
- {
- type:'pie',
- center: ['90%','10%'],
- radius: 45,
- label: {
- normal: {
- show: (mapJsonName=='NW'?false:true),
- position: 'center',
- formatter: '{b}',
- textStyle: {
- color:'#4F94CD',
- fontSize:14
- }
- },
- emphasis: {
- show: (mapJsonName=='NW'?false:true),
- position: 'center',
- formatter: '{b}',
- textStyle: {
- color:'#4F94CD',
- fontSize:14
- }
- }
- },
- itemStyle:{
- normal: {
- color: '#fff'
- }
- },
- data:[
- {value:0,name:'返回南方电网'}
- ],
- tooltip: {
- formatter:'{b}'
- }
- }
- /* {
- type:'pie',
- center: ['10%','90%'],
- radius: [35,45],
- avoidLabelOverlap: false,
- stillShowZeroSum:true,
- label: {
- normal: {
- show: true,
- position: 'inside',
- formatter: '{c}\n\n\n\n\n{b}',
- textStyle: {
- color:'#000',
- fontWeight:'bold',
- fontSize:16
- }
- },
- emphasis: {
- show: true,
- position: 'inside',
- formatter: '{c}\n\n\n\n\n{b}',
- textStyle: {
- color:'#000',
- fontWeight:'bold',
- fontSize:16
- }
- }
- },
- itemStyle:{
- normal: {
- color: '#4F94CD'
- }
- },
- data:[
- {value:compareList[0].assetTotal, name:(compareList[0].dimName.substr(0,6))}
- ],
- tooltip: {
- formatter:'{b}:{c}'
- }
- } */
- ]
- }
- $.get('geoJson/'+mapJsonName+'.json', function (geoJson) {
- echarts.registerMap(mapJsonName, geoJson);
- myChart2.setOption(option3);
- myChart2.hideLoading();
- myChart2.dispatchAction({
- type: 'downplay',
- seriesIndex: 0
- });
- myChart2.dispatchAction({
- type: 'downplay',
- seriesIndex: 1
- });
- //如果选了地市则高亮
- if(bureau_code.length>2){
- myChart2.dispatchAction({
- type: 'highlight',
- seriesIndex: 0,
- name: cui("#childUnit").getText()
- });
- myChart2.dispatchAction({
- type: 'highlight',
- seriesIndex: 1,
- name: cui("#childUnit").getText()
- });
- }
- });
- }
- });
- }
- /** echarts图表构建结束 */
- //地图点击事件
- function mapClick(){
- myChart2.on('click', function (params){
- if(params.seriesType == 'scatter' || params.seriesType=="map" || params.seriesType=="pie"){
- var tjnybm = cui("#censusDate").getValue();
- var tjnybm2 = cui("#censusDate").getValue();
- var assetType = cui("#assetTypeInput").getValue();
- var mapJson = getMapJson(params.name);
- //点击网省
- if(mapJson[0].name){
- mapJsonName =mapJson[0].name;
- geoCoordMap =mapJson[1].geo;
- $.get('geoJson/'+mapJsonName+'.json', function (geoJson) {
- echarts.registerMap(mapJsonName, geoJson);
- option3.geo.map = mapJsonName;
- var orgCode = mapJson[2].code;
- var param3 = [orgCode,tjnybm2,assetType];
- myChart2.showLoading();
- jQuery.ajax({
- type: "POST",
- url: "/web/assetmonitoring/assetScaleChart/queryAssetCompare.bpms",
- data: {'param':param3},
- traditional:true,
- async: true,
- dataType: 'json',
- success: function(result){
- var compareList = result.compareList;
- var data =[];
- jQuery.each(compareList, function(i,item){
- var objdata = {};
- objdata.name=item.dimName;
- objdata.value=item.assetTotal;
- data.push(objdata);
- });
- option3.series[0].data = convertData(data);
- option3.series[1].data = data;
- //设置圆环图表
- /* var data1 =[];
- var objdata ={};
- objdata.value = compareList[0].assetTotal;
- objdata.name = compareList[0].dimName.substr(0,6);
- data1.push(objdata);
- option3.series[1].data = data1; */
- myChart2.setOption(option3);
- myChart2.hideLoading();
- }
- })
- })
- }//点击地市局
- else{
- //高亮地市局区域和散点
- myChart2.dispatchAction({
- type: 'highlight',
- seriesIndex: 0,
- name: params.name.substr(0,2)
- });
- myChart2.dispatchAction({
- type: 'highlight',
- seriesIndex: 1,
- name: params.name.substr(0,2)
- });
- }
- //刷新分布和趋势图表
- //查询组织机构ID
- var dimId;
- jQuery.ajax({
- type: "POST",
- url: "/web/assetmonitoring/assetScaleChart/queryDimIdByName.bpms",
- data: {'param':params.name.substr(0,2)},
- async: false,
- dataType: 'json',
- success: function(data){
- var dimIdList = data.dimIdList;
- if(dimIdList.length>0){
- jQuery.each(dimIdList, function(i,item){
- dimId = item;
- });
- if(dimId.length>0 && dimId.length<=2){
- cui("#parentUnit").setValue(dimId);
- }else if(dimId.length>=4){
- cui("#childUnit").setValue(dimId);
- }
- }else{
- dimId ='00';
- cui("#parentUnit").setValue(dimId);
- cui("#childUnit").setValue('');
- }
- }
- });
- var param4 = [dimId,tjnybm,assetType];
- myChart.showLoading();
- jQuery.ajax({
- type: "POST",
- url: "/web/assetmonitoring/assetScaleChart/queryAssetDistribution.bpms",
- data: {'param':param4},
- traditional:true,
- async: true,
- dataType: 'json',
- success: function(data){
- var distributionList = data.distributionList;
- var dydj =[];
- var total = [];
- var add =[];
- jQuery.each(distributionList, function(i,item){
- dydj.push(item.dimName);
- total.push(item.assetTotal);
- add.push(item.assetNew);
- });
- option.series[0].data = total;
- option.series[1].data = add;
- option.xAxis[0].data = dydj;
- option.title.subtext = '\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n'+params.name.substr(0,2);
- myChart.setOption(option);
- myChart.hideLoading();
- }
- });
- myChart1.showLoading();
- jQuery.ajax({
- type: "POST",
- url: "/web/assetmonitoring/assetScaleChart/queryAssetTrend.bpms",
- data: {'param':param4},
- traditional:true,
- async: true,
- dataType: 'json',
- success: function(data){
- var trendList = data.trendList;
- var tjnybm3 =[];
- var total = [];
- var add =[];
- jQuery.each(trendList, function(i,item){
- tjnybm3.push(item.tjnybm);
- total.push(item.assetTotal);
- add.push(item.assetNew);
- });
- option1.series[0].data = total;
- option1.series[1].data = add;
- option1.xAxis[0].data = tjnybm3;
- option1.title.subtext = '\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n'+params.name.substr(0,2);
- myChart1.setOption(option1);
- myChart1.hideLoading();
- }
- })
- //调用列表刷新
- if(dimId.length>0 && dimId.length<=2){
- buttonClick()
- }else{
- cui("#assetScaleGrid").loadData();
- sumTypebuttonClick(assetType,true)
- }
- }});
- }
- //获取Map需加载的mapJSON名,组织编号,散点坐标数据
- function getMapJson(provinceCode){
- var mapJsonCode ={};
- var mapJsonName ={};
- var geoCoordMap1 ={};
- if(provinceCode == '00'){
- mapJsonName.name ='NW';
- mapJsonCode.code = '00';
- geoCoordMap1.geo = {
- '广东':[114.105952,24.004227],
- '云南':[102.212251,24.240609],
- '贵州':[106.713478,26.578343],
- '海南':[109.50119,19.231971],
- '广西':[108.720004,23.22402],
- '广州':[112.622414,22.519643],
- '深圳':[114.085947,22.247],
- '超高压':[114.985947,22.747]
- };
- }else if(provinceCode == '03' || provinceCode=="广东"){
- mapJsonCode.code = '03';
- mapJsonName.name ='GD';
- geoCoordMap1.geo = {
- '汕头':[116.608463,23.37102],
- '佛山':[113.122717,23.028762],
- '珠海':[113.553986,22.224979],
- '深圳':[114.085947,22.547],
- '韶关':[113.591544,24.801322],
- '广州':[113.280637,23.125178],
- '肇庆':[112.472529,23.451546],
- '梅州':[116.117582,24.299112],
- '江门':[112.594942,22.090431],
- '湛江':[110.364977,21.274898],
- '茂名':[110.919229,21.659751],
- '惠州':[114.412599,23.079404],
- '阳江':[111.975107,21.859222],
- '河源':[114.697802,23.746266],
- '中山':[113.382391,22.521113],
- '潮州':[116.832301,23.861701],
- '揭阳':[116.055733,23.443778],
- '云浮':[112.044439,22.929801],
- '汕尾':[115.364238,22.774485],
- '东莞':[113.746262,23.046237],
- '清远':[113.051227,23.685022]
- };
- }else if(provinceCode == '04' || provinceCode=="广西" ){
- mapJsonName.name ='GX';
- mapJsonCode.code = '04';
- geoCoordMap1.geo = {
- '柳州':[109.411703,24.314617],
- '防城港':[108.345478,21.614631],
- '梧州':[111.297604,23.474803],
- '桂林':[110.299121,25.274215],
- '北海':[109.119254,21.473343],
- '南宁':[108.320004,22.82402],
- '贵港':[109.602146,23.0936],
- '贺州':[111.552056,24.414141],
- '百色':[106.616285,23.897742],
- '钦州':[108.624175,21.967127],
- '玉林':[110.154393,22.63136],
- '来宾':[109.229772,23.733766],
- '崇左':[107.353926,22.404108],
- '河池':[108.062105,24.695899]
- };
- }else if(provinceCode == '05' || provinceCode=="云南"){
- mapJsonName.name ='YN';
- mapJsonCode.code = '05' ;
- geoCoordMap1.geo = {
- '保山':[99.167133,25.111802],
- '曲靖':[103.797851,25.501557],
- '昭通':[103.717216,27.336999],
- '昆明':[102.712251,25.040609],
- '丽江':[100.233026,26.872108],
- '玉溪':[102.543907,24.350461],
- '临沧':[100.08697,23.886567],
- '楚雄':[101.546046,25.041988],
- '文山':[104.24401,23.66951],
- '文山电力':[104.24401,23.26951],
- '大理':[100.225668,25.589449],
- '红河':[103.384182,23.366775],
- '普洱':[100.972344,22.777321],
- '版纳':[100.797941,22.001724],
- '德宏':[98.578363,24.436694],
- '怒江':[98.854304,25.850949],
- '迪庆':[99.706463,27.826853]
- };
- }else if(provinceCode == '06' || provinceCode=="贵州"){
- mapJsonName.name ='GZ';
- mapJsonCode.code = '06';
- geoCoordMap1.geo = {
- '安顺':[105.932188,26.245544],
- '贵阳':[106.713478,26.578343],
- '输电运行检修分公司':[106.713478,26.878343],
- '六盘水':[104.846743,26.584643],
- '铜仁':[109.191555,27.718346],
- '毕节':[105.28501,27.301693],
- '遵义':[106.937265,27.706626],
- '兴义':[104.897971,25.08812],
- '凯里':[107.977488,26.583352],
- '都匀':[107.517156,26.258219],
- '贵安':[106.217156,26.358219]
- };
- }else if(provinceCode == '07' || provinceCode=="海南"){
- mapJsonName.name ='HN';
- mapJsonCode.code = '07';
- geoCoordMap1.geo = {
- '海口':[110.33119,20.031971],
- '儋州':[109.576782,19.517486],
- '琼海':[110.466785,19.246011],
- '三亚':[109.508268,18.247872],
- '五指山':[109.516662,18.776921],
- '文昌':[110.753975,19.612986],
- '东方':[108.653789,19.10198],
- '万宁':[110.388793,18.796216],
- '定安':[110.349235,19.684966],
- '屯昌':[110.102773,19.362916],
- '澄迈':[110.007147,19.737095],
- '临高':[109.687697,19.908293],
- '昌江':[109.053351,19.260968],
- '白沙':[109.452606,19.224584],
- '陵水':[110.037218,18.505006],
- '乐东':[109.175444,18.74758],
- '保亭':[109.70245,18.636371],
- '琼中':[109.839996,19.03557],
- '三沙':[112.34882,16.831039]
- };
- }else if(provinceCode == '08' || provinceCode=="广州"){
- mapJsonName.name ='GZS';
- mapJsonCode.code = '08';
- geoCoordMap1.geo = {
- '荔湾':[113.243038,23.124943],
- '越秀':[113.280714,23.125624],
- '海珠':[113.262008,23.103131],
- '白云':[113.262831,23.162281],
- '天河':[113.335367,23.13559],
- '黄埔':[113.450761,23.103239],
- '南沙':[113.53738,22.794531],
- '番禺':[113.364619,22.938582],
- '花都':[113.211184,23.39205],
- '增城':[113.829579,23.290497],
- '从化':[113.587386,23.545283]
- };
- }else if(provinceCode == '09' || provinceCode=="深圳"){
- mapJsonName.name ='SZ';
- mapJsonCode.code = '09';
- geoCoordMap1.geo = {
- '福田':[114.05096,22.541009],
- '龙岗':[114.251372,22.721511],
- '盐田':[114.235366,22.555069],
- '罗湖':[114.123885,22.555341],
- '南山':[113.92943,22.531221],
- '宝安':[113.828671,22.754741],
- '龙华':[114.044346,22.691963],
- '坪山':[114.338441,22.69423]
- };
- }else if(provinceCode == '01' || provinceCode=="超高压"){
- mapJsonName.name ='NW';
- mapJsonCode.code = '01';
- geoCoordMap1.geo = {
- '广州局':[112.622414,22.719643],
- '贵阳局':[106.713478,26.578343],
- '南宁局':[108.320004,22.82402],
- '柳州局':[109.411703,24.314617],
- '梧州局':[111.297604,23.474803],
- '百色局':[106.616285,23.897742],
- '天生桥局':[104.897971,25.08812],
- '曲靖局':[103.797851,25.501557],
- '昆明局':[102.712251,25.040609],
- '大理局':[100.225668,25.589449]
- };
- }
- var json=[];
- json.push(mapJsonName);
- json.push(geoCoordMap1);
- json.push(mapJsonCode);
- return json;
- }