ajax传递数据

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;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值