<%@ page import="org.apache.commons.lang.StringUtils" %>
<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String basePath = request.getContextPath();
%>
<!DOCTYPE html>
<html>
<head>
    <jsp:include page="../../../common/admin/head.jsp"></jsp:include>
    <link  rel="stylesheet" type="text/css" href="<%=basePath%>/resource/css/admin/home/index.css">
</head>
<body>
    <jsp:include page="../../../common/admin/body_pre.jsp"></jsp:include>
    <div class="row hidden-print">
        <div class="col-lg-12">
            <div class="ibox">
                <div class="ibox-title">
                    <h2>农村环境</h2>
                    <ol class="breadcrumb">
                        <li>
                            <a href="javascript:void(0);" >生态环境</a>
                        </li>
                        <li class="active">
                            <strong>农村环境</strong>
                        </li>
                    </ol>
                </div>
            </div>
        </div>
    </div>
    <div class="row hidden-print">
        <div class="col-lg-4 col-md-3">
            <div class="ibox shortcut">
                <div class="ibox-title-noline">
                    <span>农村自来水普及率</span>
                </div>
                <div class="ibox-content-noline">
                    <div id="divChart1" style="width: 100%;height: 400px;"></div>
                </div>
            </div>
        </div>
        <div class="col-lg-4 col-md-3">
            <div class="ibox shortcut">
                <div class="ibox-title-noline">
                    <span>农村无害化厕所普及率</span>
                </div>
                <div class="ibox-content-noline">
                    <div id="divChart2" style="width: 100%;height: 400px;"></div>
                </div>
            </div>
        </div>
        <div class="col-lg-4 col-md-3">
            <div class="ibox shortcut">
                <div class="ibox-title-noline">
                    <span>农村无害化厕所分布</span>
                </div>
                <div class="ibox-content-noline">
                    <div id="divChart3" style="width: 100%;height: 400px;"></div>
                </div>
            </div>
        </div>
    </div>

    <div class="row hidden-print">
        <div class="col-lg-6 col-md-3">
        <div class="ibox shortcut">
            <div class="ibox-title-noline">
                <span>农村生活污水处理率级排名</span>
            </div>
            <div class="ibox-content-noline">
                <div id="divChart4" style="width: 100%;height: 400px;"></div>
                <div id="divChart5" style="width: 100%;height: 400px;"></div>
            </div>
        </div>
    </div>
        <div class="col-lg-6 col-md-3">
            <div class="ibox shortcut">
                <div class="ibox-title-noline">
                    <span>农村生活垃圾无害化处理率级排名</span>
                </div>
                <div class="ibox-content-noline">
                    <div id="divChart6" style="width: 100%;height: 400px;"></div>
                    <div id="divChart7" style="width: 100%;height: 400px;"></div>
                </div>
            </div>
        </div>
    </div>
    <jsp:include page="../../../common/admin/body_post.jsp"></jsp:include>
    <script type="text/javascript" src="<%=basePath%>/resource/plugins/echarts/echarts-liquidfill.js"></script>
    <script type="text/javascript">
        var myChart1 = echarts.init(document.getElementById('divChart1'));
        var myChart2 = echarts.init(document.getElementById('divChart2'));
        var myChart3 = echarts.init(document.getElementById('divChart3'));
        var myChart4 = echarts.init(document.getElementById('divChart4'));
        var myChart5 = echarts.init(document.getElementById('divChart5'));
        var myChart6 = echarts.init(document.getElementById('divChart6'));
        var myChart7 = echarts.init(document.getElementById('divChart7'));

            myChart1.setOption({
                xAxis: {
                    type: 'category',
                    data: []
                },
                yAxis: {
                    type: 'value'
                },
                series: [{
                    data: [],
                    type: 'line',
                    smooth: true
                }]
            });

            myChart2.setOption({
                xAxis: {
                    type: 'category',
                    data: []
                },
                yAxis: {
                    type: 'value'
                },
                series: [{
                    data: [],
                    type: 'line',
                    smooth: true
                }]
            });

            myChart3.setOption({
                tooltip : {
                    trigger: 'axis',
                    axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                        type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                legend: {
                    data: ['绿化率']
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis:  {
                    type: 'value'
                },
                yAxis: {
                    type: 'category',
                    data: []
                },
                series: [
                    {
                        name: '绿化率',
                        type: 'bar',
                        itemStyle:{
                            normal:{
                                color:'#4699d0'
                            }
                        },
                        stack: '总量',
                        label: {
                            normal: {
                                show: true,
                                position: 'insideRight'
                            }
                        },
                        data: []
                    }
                ]
            }) ;

            myChart4.setOption({
                xAxis: {
                    type: 'category',
                    data: []
                },
                yAxis: {
                    type: 'value'
                },
                series: [{
                    data: [],
                    type: 'line',
                    smooth: true
                }]
            }) ;

            myChart5.setOption({
                tooltip : {
                    trigger: 'axis',
                    axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                        type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                legend: {
                    data: ['处理率']
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis:  {
                    type: 'value'
                },
                yAxis: {
                    type: 'category',
                    data: []
                },
                series: [
                    {
                        name: '处理率',
                        type: 'bar',
                        itemStyle:{
                            normal:{
                                color:'#4699d0'
                            }
                        },
                        stack: '总量',
                        label: {
                            normal: {
                                show: true,
                                position: 'insideRight'
                            }
                        },
                        data: []
                    }
                ]
            });

            myChart6.setOption({
                xAxis: {
                    type: 'category',
                    data: []
                },
                yAxis: {
                    type: 'value'
                },
                series: [{
                    data: [],
                    type: 'line',
                    smooth: true
                }]
            }) ;

            myChart7.setOption({
                tooltip : {
                    trigger: 'axis',
                    axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                        type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                legend: {
                    data: ['处理率']
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis:  {
                    type: 'value'
                },
                yAxis: {
                    type: 'category',
                    data: []
                },
                series: [
                    {
                        name: '处理率',
                        type: 'bar',
                        itemStyle:{
                            normal:{
                                color:'#4699d0'
                            }
                        },
                        stack: '总量',
                        label: {
                            normal: {
                                show: true,
                                position: 'insideRight'
                            }
                        },
                        data: []
                    }
                ]
            });

        var renderFunc = function () {
            $.get('<%=basePath%>/admin/countryside/getCountrysideWater.action').done(function (data) {
                // 填入数据
                myChart1.setOption({
                    xAxis: {
                        type: 'category',
                        data: data.names
                    },
                    series: [{
                        data: data.quantity ,
                        type: 'line',
                        smooth: true
                    }]
                });
            })
            $.get('<%=basePath%>/admin/countryside/getCountrysideWc.action').done(function (data) {
                // 填入数据
                myChart2.setOption({
                    xAxis: {
                        type: 'category',
                        data: data.names
                    },
                    series: [{
                        data: data.quantity ,
                        type: 'line',
                        smooth: true
                    }]
                });
            })
            $.get('<%=basePath%>/admin/green/getGreenBuild.action').done(function (data) {
                // 填入数据
                myChart3.setOption({
                    yAxis: {
                        type: 'category',
                        data: data.names
                    },
                    series: [
                        {
                            name: '绿化率',
                            data: data.quantity
                        }
                    ]
                });
            })
            $.get('<%=basePath%>/admin/countryside/getCountrysideSewage.action').done(function (data) {
                // 填入数据
                myChart4.setOption({
                    xAxis: {
                        type: 'category',
                        data: data.names
                    },
                    series: [{
                        data: data.quantity ,
                        type: 'line',
                        smooth: true
                    }]
                });
            })
            $.get('<%=basePath%>/admin/countryside/getCountrysideSewageRanking.action').done(function (data) {
                // 填入数据
                myChart5.setOption({
                    yAxis: {
                        type: 'category',
                        data: data.names
                    },
                    series: [
                        {
                            name: '处理率',
                            data: data.quantity
                        }
                    ]
                });
            })
            $.get('<%=basePath%>/admin/countryside/getCountrysideGarbage.action').done(function (data) {
                // 填入数据
                myChart6.setOption({
                    xAxis: {
                        type: 'category',
                        data: data.names
                    },
                    series: [{
                        data: data.quantity ,
                        type: 'line',
                        smooth: true
                    }]
                });
            })
            $.get('<%=basePath%>/admin/countryside/getCountrysideGarbageRanking.action').done(function (data) {
                // 填入数据
                myChart7.setOption({
                    yAxis: {
                        type: 'category',
                        data: data.names
                    },
                    series: [
                        {
                            name: '处理率',
                            data: data.quantity
                        }
                    ]
                });
            })
        };
        renderFunc();
        /*setInterval(renderFunc, 3000);*/
    </script>
</body>
</html>