<%@ 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>
    <script type="text/javascript" src="<%=basePath%>/resource/plugins/echarts/echarts.min.js"></script>
</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>

            </div>
        </div>
    </div>
</div>
<jsp:include page="../../../common/admin/grid_pre.jsp"></jsp:include>

<div class="row hidden-print">
    <div class="col-lg-6 col-md-6">
        <div class="ibox shortcut">

            <div id="divChart1" style="width: 100%;height: 400px;"></div>
        </div>
    </div>
    <div class="col-lg-6 col-md-6">
        <div class="ibox shortcut">
            <div id="divChart2" style="width: 100%;height: 400px;"></div>
        </div>
    </div>

</div>
<div class="row hidden-print">
    <div class="col-lg-6 col-md-6">
        <div class="ibox shortcut">

            <div id="divChart3" style="width: 100%;height: 400px;"></div>
        </div>
    </div>

    <div class="col-lg-6 col-md-6">
        <div class="ibox shortcut">
            <div id="divChart4" style="width: 100%;height: 400px;"></div>
        </div>
    </div>

</div>
<jsp:include page="../../../common/admin/grid_post.jsp"></jsp:include>
<jsp:include page="../../../common/admin/body_post.jsp"></jsp:include>
<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 renderFunc = function () {
        $.get('<%=basePath%>/admin/resourceAndUserCount/list.action',function (data) {
            myChart1.setOption ({
                title : {
                    text: '资源总数统计',
                    // subtext: '纯属虚构',
                    x:'center'
                },
                tooltip : {
                    trigger: 'item',
                    formatter: "{a} <br/>{b} : {c} ({d}%)"
                },
                legend: {
                    orient: 'vertical',
                    left: 'left',
                    data: data.name
                },
                series : [

                    {
                        label: {
                            normal: {
                                show: false,
                                position: 'center'
                            },
                            emphasis: {
                                show: true,
                                textStyle: {
                                    fontSize: '30',
                                    fontWeight: 'bold'
                                }
                            }
                        },
                        name: '资源数量',
                        type: 'pie',
                        radius: ['50%', '70%'],
                        data:data,
                        itemStyle: {
                            emphasis: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                            }
                        },
                        labelLine: {
                            normal: {
                                show: false
                            }
                        },
                    }
                ]
            });

        });

        $.get('<%=basePath%>/admin/resourceAndUserCount/list2.action',function (data) {
            myChart2.setOption ({
                title : {
                    text: '用户总数统计',
                    x:'center'
                },
                tooltip : {
                    trigger: 'item',
                    formatter: "{a} <br/>{b} : {c} ({d}%)"
                },
                legend: {
                    orient: 'vertical',
                    left: 'left',
                    data: data.name
                },
                series : [
                    {
                        label: {
                            normal: {
                                show: false,
                                position: 'center'
                            },
                            emphasis: {
                                show: true,
                                textStyle: {
                                    fontSize: '30',
                                    fontWeight: 'bold'
                                }
                            }
                        },
                        name: '用户总数',
                        type: 'pie',
                        radius: ['50%', '70%'],
                        data:data,
                        itemStyle: {
                            emphasis: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                            }
                        },
            labelLine: {
                normal: {
                    show: false
                }
            },
                    }
                ]
            });

        });
        $.get('<%=basePath%>/admin/resourceAndUserCount/list3.action',function (data) {
            myChart3.setOption ({
                title : {
                    text: '资源浏览统计',
                    x:'center'
                },
                tooltip : {
                    trigger: 'item',
                    formatter: "{a} <br/>{b} : {c} ({d}%)"
                },
                legend: {
                    orient: 'vertical',
                    left: 'left',
                    data: data.name
                },
                series : [
                    {
                        label: {
                            normal: {
                                show: false,
                                position: 'center'
                            },
                            emphasis: {
                                show: true,
                                textStyle: {
                                    fontSize: '30',
                                    fontWeight: 'bold'
                                }
                            }
                        },
                        name: '浏览数量',
                        type: 'pie',
                        radius: ['50%', '70%'],
                        data:data,
                        itemStyle: {
                            emphasis: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                            }
                        },
                        labelLine: {
                            normal: {
                                show: false
                            }
                        },
                    }
                ]
            });

        });

        $.get('<%=basePath%>/admin/resourceAndUserCount/list4.action',function (data) {
            myChart4.setOption ({
                title : {
                    text: '资源关注统计',
                    x:'center'
                },
                tooltip : {
                    trigger: 'item',
                    formatter: "{a} <br/>{b} : {c} ({d}%)"
                },
                legend: {
                    orient: 'vertical',
                    left: 'left',
                    data: data.name
                },
                series : [
                    {
                        label: {
                            normal: {
                                show: false,
                                position: 'center'
                            },
                            emphasis: {
                                show: true,
                                textStyle: {
                                    fontSize: '30',
                                    fontWeight: 'bold'
                                }
                            }
                        },
                        name: '浏览数量',
                        type: 'pie',
                        radius: ['50%', '70%'],
                        data:data,
                        itemStyle: {
                            emphasis: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                            }
                        },
                        labelLine: {
                            normal: {
                                show: false
                            }
                        },
                    }
                ]
            });

        });
    }

    renderFunc();

</script>
</body>
</html>