结对作业之全国疫情统计可视化地图

图表

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
        request.setCharacterEncoding("utf-8");
        predao dao=new predao();
        ArrayList<Pre> list=dao.getquanguo();
        request.setAttribute("pres", list);
        request.getRequestDispatcher("HTALC.jsp").forward(request, response);
    }
 <script type="text/javascript">
    var myChart = echarts.init(document.getElementById('main'));

    var arr = new Array();
    var index = 0;
    <c:forEach items="${pres}" var="goods">
        arr[index++] = ${goods.confirmed};
    </c:forEach>
    var option = {
        title: {
            text: '全国疫情统计'
        },
        tooltip: {
            show: true
        },
        legend: {
            data:['患者数']
        },
        xAxis : [
            {
                type : 'category',
                data : [
                    <c:forEach items="${pres}" var="g">
                    ["${g.name}"],
                    </c:forEach>
                ]
            }
        ],
        yAxis : [
            {
                type : 'value'
            }
        ],
        series : [
            {
                name:'患者数',
                type:'bar',
                data: arr
            }
        ]
    };
    myChart.setOption(option);
</script>

 

posted @ 2021-03-19 19:09  谦寻  阅读(5)  评论(0编辑  收藏  举报