<%@ 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 : {
                    formatter: "{a} <br/>{b} : {c}%"
                },
                toolbox: {
                    feature: {
                        restore: {},
                        saveAsImage: {}
                    }
                },
                series: [
                    {
                        name: '区域环境噪声平均值',
                        type: 'gauge',
                        // detail: {formatter:'{value}%'},
                        data: []
                    }
                ]
            });

            myChart2.setOption({
                tooltip : {
                    formatter: "{a} <br/>{b} : {c}%"
                },
                toolbox: {
                    feature: {
                        restore: {},
                        saveAsImage: {}
                    }
                },
                series: [
                    {
                        name: '交通干线噪声平均',
                        type: 'gauge',
                        // detail: {formatter:'{value}%'},
                        data: []
                    }
                ]
            });

            myChart3.setOption({
                series: [{
                    name: '处理率',
                    type: 'liquidFill',
                    data: [],
                    radius: '80%'
                }]
            }) ;

            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/noise/getNoiseRegion.action').done(function (data) {
                // 填入数据
                myChart1.setOption({
                    series: [{
                        // 根据名字对应到相应的系列
                        name: '生活垃圾无害化处理率',
                        data: [data]
                    }]
                });
            })
            $.get('<%=basePath%>/admin/noise/getNoiseTraffic.action').done(function (data) {
                // 填入数据
                myChart2.setOption({
                    series: [{
                        // 根据名字对应到相应的系列
                        name: '生活垃圾无害化处理率',
                        data: [data]
                    }]
                });
            })
            $.get('<%=basePath%>/admin/garbage/getGarbagedangerRegion.action').done(function (data) {
                // 填入数据
                myChart3.setOption({
                    series: [{
                        // 根据名字对应到相应的系列
                        name: '处理率',
                        data: [data]
                    }]
                });
            })
            $.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>