conctroller层
/**
* 工作台 地图(区域统计)
* @author mayc
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping("indexAction!getMemberMonthSummarize.do")
public Map getMemberMonthSummarize() throws Exception {
TaParamDto taDto = getTaDto();
Map tmap = new HashMap();
List memberMonthCountList = getDao().queryForList("taworkCount.getMemberMonthCount");
tmap.put("memberMonthCountList",memberMonthCountList);
return tmap;
}
/**
* 工作台 企业类型统计
* @author mayc
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping("indexAction!getCompanySummarize.do")
public Map getCompanySummarize() throws Exception {
Map tmap = new HashMap();
List typeList = getDao().queryForList("taworkCount.getCompanyPieType");
List setList = getDao().queryForList("taworkCount.getCompanyPieSet");
tmap.put("typeList",typeList);
tmap.put("setList",setList);
return tmap;
}
}
ajax传递echarts数据
通用格式:
$.ajax({
url:Base.globvar.basePath+"/indexAction!getMapSummarize.do",
dataType:"json",
type:"post",
success:function (data) {
console.log(data);
}
$.ajax({
url:Base.globvar.basePath+"/indexAction!getMapSummarize.do",
dataType:"json",
type:"post",
success:function (data) {
console.log(data);
myChart.setOption(option = {
backgroundColor: '#fff',
title: {
text : '湖北17市区会员人数分布',
left:'center',
textStyle:{
//文字颜色
color:'#333',
//字体风格,'normal','italic','oblique'
fontStyle:'normal',
//字体粗细 'normal','bold','bolder','lighter',100 | 200 | 300 | 400...
fontWeight:'bold',
//字体系列
fontFamily:'sans-serif',
//字体大小
fontSize:18
}
},
toolbox: {
show : true,
orient : 'vertical',
x: 'right',
y: 'center',
feature : {
mark : {show: true},
dataView : {show: true, readOnly: false},
restore : {show: true},
saveAsImage : {show: true}
}
},
tooltip: {
trigger: 'item',
formatter: '{b}<br/>{c} (人)'
},
legend: {
orient: 'vertical',
left: 'left',
top: "center",
data: ['人口密度']
},
dataRange: {
min: 800,
max: 1000000,
text:['High','Low'],
realtime: false,
calculable : true,
color: ['orangered','yellow','lightskyblue']
},
series: [
{
name: '湖北17市区会员人口密度',
type: 'map',
mapType: 'HUBEI', // 自定义扩展图表类型
itemStyle:{
normal: {
borderColor: '#389BB7',
areaColor: ['#a6d9f3'],
},
emphasis: {
areaColor: '#389BB7',
borderWidth: 0
}
},
label: {
normal: {
show: true
},
emphasis: {
show: true
}
},
data:parseArea(data.mapDataList)
,
textFixed : {
'Yau Tsim Mong' : [-10, 0]
},
// 文本直接经纬度定位
geoCoord : {
'Islands' : [113.95, 22.26]
}
}
]
});
},
beforeSend:function () {
showMask("quyutongji");
},
complete:function () {
hideMask("quyutongji");
}
})
function parseArea(mapDataList) {
var data=[];
var map=echarts.getMap('HUBEI').geoJson.features;
$(map).each(function (a,b) {
data.push({name:b.properties.name,value:0})
});
data=$.extend(data,mapDataList);
return data;
}