echarts环图

<!--查询培训状态,培训人数-->
    <select id="selectExternalEcharts" resultType="java.util.Map">
SELECT
          sum(    CASE TRAIN_STATE WHEN   '未培训' THEN 1 ELSE 0 END ) a  ,
          sum(    CASE TRAIN_STATE WHEN   '培训中' THEN 1 ELSE 0 END )  b ,
          sum(     CASE TRAIN_STATE WHEN  	 '培训通过' THEN 1 ELSE 0 END )  c

      FROM ZT_HWBK_RLZYBZGL
      where
              STATUS = '1'
        <if test="ltype != null and ltype != 'null' and ltype != 'undefined' and ltype != '' and ltype != undefined">
            and   EMPLOYEE_TYPE=#{ltype}
        </if>

    </select>
    <!--查询培训状态,各类别的人数-->
    <select id="selectExternalEcharts2" resultType="java.util.Map">
SELECT
				  sum(     CASE EMPLOYEE_TYPE WHEN  	 '海外人员' THEN 1 ELSE 0 END )  aa ,
          sum(     CASE EMPLOYEE_TYPE WHEN  	 '后备人员' THEN 1 ELSE 0 END )  bb ,
			    sum(     CASE EMPLOYEE_TYPE WHEN  	 '在库人员' THEN 1 ELSE 0 END )  cc ,
					sum(     CASE EMPLOYEE_TYPE WHEN  	 '其他人员' THEN 1 ELSE 0 END )  dd

      FROM ZT_HWBK_RLZYBZGL
      where
              STATUS = '1'

     <if test="train != null and train != 'null' and train !='undefined' and train !='' and train !=undefined ">
         and    TRAIN_STATE=#{train}
     </if>

    </select>
   /**
     * 一级页面获类型环形图
     * @return
     */
    @RequestMapping(value = "/getLssData")
    @ResponseBody
    public List<Map> selectExternalEcharts2() {
        List<Map> rateList = new ArrayList<>();
        try{
            Map<String,Object> map = new HashMap<>();
            String train = this.getPara("train");
                map.put("train",train);
            rateList = languageCompetenceDevelopmentService.selectExternalEcharts2(map);
        }catch (Exception e){
            e.printStackTrace();
        }
        return rateList;
    }

    /**

     * 一级页面获取培训状态环形图
     * @return
     */
    @RequestMapping(value = "/getYssData")
    @ResponseBody
    public List<Map> selectExternalEcharts() {
        List<Map> rateList = new ArrayList<>();
        try{
            Map<String,Object> map = new HashMap<>();
            String ltype = this.getPara("ltype");
            map.put("ltype",ltype);
            rateList = languageCompetenceDevelopmentService.selectExternalEcharts(map);
        }catch (Exception e){
            e.printStackTrace();
        }
        return rateList;
    }

    /*echarts图表数据源*/
    function echartsData1(ltype) {
        var dwtype1, ajinum1, bjinum1, cjinum1, djinum1;
        $.ajax({
            type: "get",
            url: "${root!}/haiwaiyuyannenglipeiyang/languageCompetenceDevelopment/getYssData?ltype="+ltype,
            success: function (res) {
                console.log("res==?>"+res);

                        ajinum1 = res[0].A;
                        bjinum1 = res[0].B;
                        cjinum1 = res[0].C;

 
                option1 = {

                    legend: {
                        orient: 'vertical',
                        x: 'left',
                        padding:[0,10,10,20],
                        show: true,
                        top: "20",
                        itemWidth: 10,
                        itemHeight: 10,
                        itemGap: 10,
                        title: '培训',
                        data: ['未培训',  '培训中','培训通过'],
                        icon: "circle",
                        borderRadius: [50, 50, 50, 50],
                        // color: "red",

                    },
                    grid: {
                        //调整整个echars图的大小
                        top: '25%',
                        left: '20%',
                        right: '30%',
                        bottom: '20%',
                        containLabel: true
                    },
                    tooltip: {
                        show: true, //显示提示框
                        formatter: "{a}{b}:{c}个({d}%)",
                    },
                    color: ['#7b86ed', '#f79b03', '#00a2e8'],
                    series: [
                        {
                            name: 'peixun ',
                            type: "pie",
                            radius: ["30%", "55%"],
                            avoidLabelOverlap: true,
                            center: ['50%', '50%'],
                            label: {
                                normal: {
                                    show: true,
                                    position: "",
                                    // color: "#217ef9",
                                    formatter: "数量:{c}\n比例:{d}%",
                                    textStyle: {
                                        fontSize: 10,
                                    }
                                },
                                emphasis: { //选中时候的样式
                                    show: true,
                                }
                            },
                            labelLine: {
                                normal: {
                                    show: true
                                }
                            },
                            itemStyle: {
                                borderWidth: 2, //设置border的宽度有多大
                                borderColor: '#fff',
                            },

                            data: [
                                {value: ajinum1, name: '未培训'},
                                {value: bjinum1, name: '培训中'},
                                {value: cjinum1, name: '培训通过'},


                            ]

                        },
                        // 设置值域的标签

                    ]
                }

                //获取dom容器
                var myChart = echarts.init(document.getElementById('ring_charts_03'));
                // 使用刚指定的配置项和数据显示图表。
                myChart.setOption(option1);




            }
        })

    }
    /*echarts图表数据源*/
    function echartsData2(train) {
        var dwtype1, ajinum1, bjinum1, cjinum1, djinum1;
        $.ajax({
            type: "get",
            url: "${root!}/haiwaiyuyannenglipeiyang/languageCompetenceDevelopment/getLssData?train=" +train,
            success: function (res) {
                console.log("res==>"+res);

                        ajinum1 = res[0].AA;
                        bjinum1 = res[0].BB;
                        cjinum1 = res[0].CC;
                        djinum1 = res[0].DD;
                        console.log("ajinum1+>"+ajinum1)
                        console.log("bjinum1+>"+bjinum1)
                        console.log("cjinum1+>"+cjinum1)
                        console.log("djinum1+>"+djinum1)

                //恒大地产
                option1 = {

                    legend: {
                        orient: 'vertical',
                        x: 'left',
                        padding:[0,10,10,20],
                        show: true,
                        top: "20",
                        itemWidth: 10,
                        itemHeight: 10,
                        itemGap: 10,
                        title: '获取类型',
                        data: ['海外人员',  '后备人员','在库人员', '其他人员'],
                        icon: "circle",
                        borderRadius: [50, 50, 50, 50],
                        // color: "red",

                    },
                    grid: {
                        //调整整个echars图的大小
                        top: '25%',
                        left: '20%',
                        right: '30%',
                        bottom: '20%',
                        containLabel: true
                    },
                    tooltip: {
                        show: true, //显示提示框
                        formatter: "{a}{b}:{c}个({d}%)",
                    },
                    color: ['#7b86ed', '#f79b03', '#00a2e8', '#de5037'],
                    series: [
                        {
                            name: '类型',
                            type: "pie",
                            radius: ["30%", "55%"],
                            avoidLabelOverlap: true,
                            center: ['50%', '50%'],
                            label: {
                                normal: {
                                    show: true,
                                    position: "",
                                    // color: "#217ef9",
                                    formatter: "数量:{c}\n比例:{d}%",
                                    textStyle: {
                                        fontSize: 10,
                                    }
                                },
                                emphasis: { //选中时候的样式
                                    show: true,
                                }
                            },
                            labelLine: {
                                normal: {
                                    show: true
                                }
                            },
                            itemStyle: {
                                borderWidth: 2, //设置border的宽度有多大
                                borderColor: '#fff',
                            },

                            data: [
                                {value: ajinum1, name: '海外人员'},
                                {value: bjinum1, name: '后备人员'},
                                {value: cjinum1, name: '在库人员'},
                                {value: djinum1, name: '其他人员'},

                            ]

                        },
                        // 设置值域的标签

                    ]
                }

                //获取dom容器
                var myChart = echarts.init(document.getElementById('ring_charts_04'));
                // 使用刚指定的配置项和数据显示图表。
                myChart.setOption(option1);




            }
        })

    }

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值