<%@ 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-3 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-3 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-3 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 class="col-lg-3 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>
            </div>
        </div>
    </div>

    <div class="row hidden-print">
        <div class="col-lg-12 col-md-3">
            <div class="ibox shortcut">
                <div class="ibox-title-noline">
                    <span>森林覆盖情况</span>
                </div>
                <div class="ibox-content-noline">
                    <div id="divChart5" 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'));

            myChart1.setOption({
                tooltip: {
                    trigger: 'axis'
                },
                legend: {
                    data:['实际绿化率','预测绿化率']
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                toolbox: {
                    feature: {
                        saveAsImage: {}
                    }
                },
                xAxis: {
                    type: 'category',
                    boundaryGap: false,
                    data: []
                },
                yAxis: {
                    type: 'value'
                },
                series: [
                    {
                        name:'实际绿化率',
                        type:'line',
                        stack: '总量',
                        data:[]
                    },
                    {
                        name:'预测绿化率',
                        type:'line',
                        stack: '总量',
                        data:[]
                    }
                ]
            });

            myChart2.setOption({
                tooltip: {
                    trigger: 'axis'
                },
                legend: {
                    data:['实际覆盖率','预测覆盖率']
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                toolbox: {
                    feature: {
                        saveAsImage: {}
                    }
                },
                xAxis: {
                    type: 'category',
                    boundaryGap: false,
                    data: []
                },
                yAxis: {
                    type: 'value'
                },
                series: [
                    {
                        name:'实际覆盖率',
                        type:'line',
                        stack: '总量',
                        data:[]
                    },
                    {
                        name:'预测覆盖率',
                        type:'line',
                        stack: '总量',
                        data:[]
                    }
                ]
            });

            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({
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {
                        type: 'cross',
                        crossStyle: {
                            color: '#999'
                        }
                    }
                },
                toolbox: {
                    feature: {
                        dataView: {show: true, readOnly: false},
                        magicType: {show: true, type: ['line', 'bar']},
                        restore: {show: true},
                        saveAsImage: {show: true}
                    }
                },
                legend: {
                    data:['垃圾产生量','无害处理量','无害处理率']
                },
                xAxis: [
                    {
                        type: 'category',
                        data: [],
                        axisPointer: {
                            type: 'shadow'
                        }
                    }
                ],
                yAxis: [
                    {
                        type: 'value',
                        name: '吨',
                        min: 0,
                        max: 250,
                        interval: 50,
                        axisLabel: {
                            formatter: '{value}'
                        }
                    },
                    {
                        type: 'value',
                        name: '百分比',
                        min: 0,
                        max: 25,
                        interval: 5,
                        axisLabel: {
                            formatter: '{value}%'
                        }
                    }
                ],
                series: [
                    {
                        name:'垃圾产生量',
                        type:'bar',
                        data:[]
                    },
                    {
                        name:'无害处理量',
                        type:'bar',
                        data:[]
                    },
                    {
                        name:'无害处理率',
                        type:'line',
                        yAxisIndex: 1,
                        data:[]
                    }
                ]
            }) ;

            myChart5.setOption({
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {
                        type: 'cross',
                        crossStyle: {
                            color: '#999'
                        }
                    }
                },
                toolbox: {
                    feature: {
                        dataView: {show: true, readOnly: false},
                        magicType: {show: true, type: ['line', 'bar']},
                        restore: {show: true},
                        saveAsImage: {show: true}
                    }
                },
                legend: {
                    data:['工业危险废物产生量','工业危险废物无害处理量','工业危险废物无害处理率']
                },
                xAxis: [
                    {
                        type: 'category',
                        data: [],
                        axisPointer: {
                            type: 'shadow'
                        }
                    }
                ],
                yAxis: [
                    {
                        type: 'value',
                        name: '吨',
                        min: 0,
                        max: 250,
                        interval: 50,
                        axisLabel: {
                            formatter: '{value}'
                        }
                    },
                    {
                        type: 'value',
                        name: '百分比',
                        min: 0,
                        max: 25,
                        interval: 5,
                        axisLabel: {
                            formatter: '{value}%'
                        }
                    }
                ],
                series: [
                    {
                        name:'工业危险废物产生量',
                        type:'bar',
                        data:[]
                    },
                    {
                        name:'工业危险废物无害处理量',
                        type:'bar',
                        data:[]
                    },
                    {
                        name:'工业危险废物无害处理率',
                        type:'line',
                        yAxisIndex: 1,
                        data:[]
                    }
                ]
            });

        var renderFunc = function () {
            $.get('<%=basePath%>/admin/green/getGreenCity.action').done(function (data) {
                // 填入数据
                myChart1.setOption({
                    xAxis: {
                        data: data.names
                    },
                    series: [
                        {
                            name:'实际绿化率',
                            data: data.quantity
                        },
                        {
                            name:'预测绿化率',
                            data: data.forecastQuantity
                        }
                    ]
                });
            })
            $.get('<%=basePath%>/admin/green/getGreenForest.action').done(function (data) {
                // 填入数据
                myChart2.setOption({
                    xAxis: {
                        data: data.names
                    },
                    series: [
                        {
                            name:'实际覆盖率',
                            data: data.quantity
                        },
                        {
                            name:'预测覆盖率',
                            data: data.forecastQuantity
                        }
                    ]
                });
            })
            $.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/garbage/getGarbageTrend.action').done(function (data) {
                // 填入数据
                myChart4.setOption({
                    xAxis: {
                        data: data.years
                    },
                    series: [{
                        // 根据名字对应到相应的系列
                        name: '垃圾产生量' ,
                        data: data.produceCounts
                    },{
                        // 根据名字对应到相应的系列
                        name: '无害处理量' ,
                        data: data.treatment
                    },{
                        // 根据名字对应到相应的系列
                        name: '无害处理率' ,
                        data: data.treatmentRate
                    }]
                });
            })
            $.get('<%=basePath%>/admin/garbage/getGarbagedangerTrend.action').done(function (data) {
                // 填入数据
                myChart5.setOption({
                    xAxis: {
                        data: data.years
                    },
                    series: [{
                        // 根据名字对应到相应的系列
                        name: '工业危险废物产生量' ,
                        data: data.produceCounts
                    },{
                        // 根据名字对应到相应的系列
                        name: '工业危险废物无害处理量' ,
                        data: data.treatment
                    },{
                        // 根据名字对应到相应的系列
                        name: '工业危险废物无害处理率' ,
                        data: data.treatmentRate
                    }]
                });
            })
        };
        renderFunc();
        /*setInterval(renderFunc, 3000);*/
    </script>
</body>
</html>