<!DOCTYPE html>
<!--[if IE 8]>
<html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
    <base href="#springUrl('/assets/adminlte/')"/>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>工作台</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.5 -->
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="plugins/ionicons/css/ionicons.min.css">

    <!-- DataTables -->
    <link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css">

    <!-- Theme style -->
    <link rel="stylesheet" href="dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
    <!-- iCheck -->
    <link rel="stylesheet" href="plugins/iCheck/flat/blue.css">
    <!-- Date Picker -->
    <link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
    <!-- Daterange picker -->
    <link rel="stylesheet" href="plugins/daterangepicker/daterangepicker-bs3.css">
    <!-- bootstrap wysihtml5 - text editor -->
    <link rel="stylesheet" href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
    <!--validate css-->
    <link rel="stylesheet" href="plugins/jquery-validation/css/validate.css">
    <!--fileinput css-->
    <link rel="stylesheet" href="plugins/bootstrap-fileinput/bootstrap-fileinput.css">
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<!-- END HEAD -->
<body class="hold-transition skin-blue sidebar-mini">

<div class="wrapper">
    <div class="content-wrapper" style="margin-left:0;">

        <section class="content-header">
            <h1>
                研讨会统计管理
                <small>研讨会统计</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i>首页</a></li>
                <li><a class="active"></a></li>
            </ol>
        </section>


        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <!-- general form elements disabled -->
                    <div class="box box-primary">
                        <input name="id" value="$!{data.id}" hidden="true"/>
                        <div class="box-body">
                            <div class="form-group form-md-line-input" id="bar" style="width: 100%;height: 600px;">


                            </div>
                            <br/>
                            <!--<div class="form-group form-md-line-input" id="pie" style="width: 100%;height: 600px;">


                            </div>-->
                            <section class="content">
                                <div class="row">
                                    <div class="col-xs-12">
                                        <div class="box">
                                            <div class="box-header">
                                                <form id="seachTableForm1" action="#springUrl('/a/statistics/exportExcelSampleCount')" method="get">
                                                    <div class="col-xs-5">
                                                        <input type="text" style="display: none;" name="meetingId" value="$!{meetingId}"/>
                                                        <button class="btn btn-primary">导出</button>
                                                    </div>
                                                </form>
                                            </div><!-- /.box-header -->
                                            <div class="box-body">
                                                <table id="table1" class="table table-bordered table-striped">
                                                    <thead>
                                                    <tr>
                                                        <td hidden="true">Id</td>
                                                        <th>样本标题</th>
                                                        <th>查看率</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody id="tablebody1">
                                                    </tbody>

                                                </table>
                                            </div><!-- /.box-body -->
                                        </div><!-- /.box -->
                                    </div><!-- /.col -->
                                </div><!-- /.row -->
                            </section><!-- /.content -->
                            <br/>
                            <div class="form-group form-md-line-input" id="bar1" style="width: 100%;height: 600px;">


                            </div>
                            <br/>
                            <!-- <div class="form-group form-md-line-input" id="pie1" style="width: 100%;height: 600px;">


                             </div>-->
                            <section class="content">
                                <div class="row">
                                    <div class="col-xs-12">
                                        <div class="box">
                                            <div class="box-header">
                                                <form id="seachTableForm" action="#springUrl('/a/statistics/exportExcelSampleClick')" method="get">
                                                    <div class="col-xs-5">
                                                        <input type="text" style="display: none;" name="meetingId" value="$!{meetingId}"/>
                                                        <button class="btn btn-primary">导出</button>
                                                    </div>
                                                </form>
                                            </div><!-- /.box-header -->
                                            <div class="box-body">
                                                <table id="table" class="table table-bordered table-striped">
                                                    <thead>
                                                    <tr>
                                                        <td hidden="true">Id</td>
                                                        <th>样本标题</th>
                                                        <th>点击量</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody id="tablebody">
                                                    </tbody>

                                                </table>
                                            </div><!-- /.box-body -->
                                        </div><!-- /.box -->
                                    </div><!-- /.col -->
                                </div><!-- /.row -->
                            </section><!-- /.content -->
                        </div>

                        <div class="box-footer">
                            <a href="#springUrl('/a/statistics/list')" class="btn btn-default">返回</a>
                        </div>
                        <!-- /.box-body -->
                    </div><!-- /.box -->


                </div><!-- /.col -->
            </div><!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->


    <!-- Add the sidebar's background. This div must be placed
         immediately after the control sidebar -->
    <div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->

<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/extensions/i18n/lanauage_ch.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="plugins/fastclick/fastclick.min.js"></script>
<!--fileinput js-->
<script src="plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script src="plugins/bootstrap-maxlength/bootstrap-maxlength.min.js" type="text/javascript"></script>
<script src="plugins/security/sha256.js" type="text/javascript"></script>
<script src="plugins/jquery-validation/js/jquery.validate.min.js"></script>
<script src="js/jquery.form.min.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/lang/zh-cn/zh-cn.js"></script>
<script src="js/echarts.js"></script>
<script src="common/js/cfapp.js"></script>
<!-- END PAGE LEVEL PLUGINS -->
<script>

    var myChart = echarts.init(document.getElementById('bar'));

    // var myChart2 = echarts.init(document.getElementById('pie'));

    var myChart3 = echarts.init(document.getElementById('bar1'));

    //var myChart4 = echarts.init(document.getElementById('pie1'));

    option = {
        title : {
            text: '样本内容查看率(查看率=样本总点击量/该研讨会签到人数)统计(数值)柱状图分析',
            subtext: '',
            x:'left'
        },
        tooltip : {
            formatter: "{a} <br/>{b} : {c}%",
            trigger: 'item',
            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },

        toolbox: {
            feature: {
                dataView: {show: true, readOnly: false},
                magicType: {show: true, type: ['line', 'bar']},
                restore: {show: true},
                saveAsImage: {show: true}
            }
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        xAxis : [
            {
                type : 'category',
                data : ${barType},
                axisTick: {
                    alignWithLabel: true
                }
            }
        ],
        yAxis : [
            {
                type : 'value',
                name: '内容查看率',
                min: 0,
                axisLabel: {
                    formatter: '{value}%'
                }
            }
        ], legend: {
            orient: 'vertical',
            left: 'left',
            data: ${barType}
        },
        series : [
            {
                name:'样本内容查看率',
                type:'bar',
                barWidth: '60%',
                data:${barValue},
                label: {
                    normal: {
                        show: true,
                        formatter: '{c}%'
                    }
                },
                itemStyle: {
                    normal: {
                        color: function (params) {
                            if (params.value > 0 && params.value < 100) {
                                return "#FE8463";
                            } else if (params.value >= 100 && params.value <= 300) {
                                return "#27727B";
                            }
                            return "#9BCA63";
                        }
                    }
                }
            }
        ]
    };

    myChart.setOption(option);


    /*  option2 = {
     title : {
     text: '样本内容查看率统计(百分比)饼图分析',
     subtext: '',
     x:'left'
     },
     tooltip : {
     trigger: 'item',
     formatter: "{a} <br/>{b} : {c}%"
     },
     legend: {
     orient: 'vertical',
     x: 'left',
     y: '20%',
     data: ${barType}
     },
     series : [
     {
     name: '样本内容查看率',
     type: 'pie',
     radius : '70%',
     center: ['70%', '60%'],
     data:${pieValue},
     itemStyle: {
     emphasis: {
     shadowBlur: 10,
     shadowOffsetX: 0,
     shadowColor: 'rgba(0, 0, 0, 0.5)'
     }
     }
     }
     ]
     };

     myChart2.setOption(option2);*/

    option3 = {
        title : {
            text: '样本内容点击量统计(数值)柱状图分析',
            subtext: '',
            x:'left'
        },
        tooltip : {
            trigger: 'item',
            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },

        toolbox: {
            feature: {
                dataView: {show: true, readOnly: false},
                magicType: {show: true, type: ['line', 'bar']},
                restore: {show: true},
                saveAsImage: {show: true}
            }
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        xAxis : [
            {
                type : 'category',
                data : ${barType},
                axisTick: {
                    alignWithLabel: true
                }
            }
        ],
        yAxis : [
            {
                type : 'value'

            }
        ], legend: {
            orient: 'vertical',
            left: 'left',
            data: ${barType}
        },
        series : [
            {
                name:'内容点击量',
                type:'bar',
                barWidth: '60%',
                data:${barValue1},
                label: {
                    normal: {
                        show: true,
                        formatter: '{c}'
                    }
                },itemStyle: {
                normal: {
                    color: function (params) {
                        if (params.value > 0 && params.value < 200) {
                            return "#FF6A6A";
                        } else if (params.value >= 200 && params.value < 400) {
                            return "#8FBC8F";
                        }else if(params.value >=400){
                            return "#046930";
                        }
                        return "#9BCA63";
                    }
                }
            }
            }
        ]
    };

    myChart3.setOption(option3);


    /* option4 = {
     title : {
     text: '样本内容点击量统计(百分比)饼图分析',
     subtext: '',
     x:'left'
     },
     tooltip : {
     trigger: 'item',
     formatter: "{a} <br/>{b} : {c}% ({d}%)"
     },
     legend: {
     orient: 'vertical',
     x: 'left',
     y: '20%',
     data: ${barType}
     },
     series : [
     {
     name: '内容点击量',
     type: 'pie',
     radius : '70%',
     center: ['50%', '60%'],
     data:${pieValue1},
     itemStyle: {
     emphasis: {
     shadowBlur: 10,
     shadowOffsetX: 0,
     shadowColor: 'rgba(0, 0, 0, 0.5)'
     }
     }
     }
     ]
     };

     myChart4.setOption(option4);*/

    function seachTable() {
        var sSource = "#springUrl('/a/statistics/listDataSampleClick')";
        var aoData = {
            iDisplayStart: 1,
            iDosplayLength: 10
        }
        var retrieveData = function (sSource, aoData, fnCallback) {

            $("#seachTableForm input").each(function () {
                var params = {
                    name: $(this).attr("name"),
                    value: $(this).val()
                };
                aoData.push(params);
            })

            $.ajax({
                "type": "GET",
                "url": sSource,
                "dataType": "json",
                "data": aoData, //以json格式传递
                "success": fnCallback
            });
        };

        $('#table').DataTable({
            "lengthChange": false,
            "searching": false,
            "ordering": false,
            "bFiltered": false,
            "bStateSave": true, // save datatable state(pagination, sort, etc) in cookie.
            "bProcessing": true,
            "bServerSide": true,
            "sAjaxSource": sSource,
            "fnServerData": retrieveData,
            "pagingType": "full_numbers",
            "aoColumns": [
                {
                    "mData": "id"
                },
                {
                    "mData": "sample_title"
                },
                {
                    "mData": "clicks"
                }],
            "aoColumnDefs": [
                { // set default column settings
                    'visible': false,
                    'targets': [0]
                }

            ]
        });
    }

    function seachTable1() {
        var sSource = "#springUrl('/a/statistics/listDataSampleCount')";
        var aoData = {
            iDisplayStart: 1,
            iDosplayLength: 10
        }
        var retrieveData = function (sSource, aoData, fnCallback) {

            $("#seachTableForm1 input").each(function () {
                var params = {
                    name: $(this).attr("name"),
                    value: $(this).val()
                };
                aoData.push(params);
            })

            $.ajax({
                "type": "GET",
                "url": sSource,
                "dataType": "json",
                "data": aoData, //以json格式传递
                "success": fnCallback
            });
        };

        $('#table1').DataTable({
            "lengthChange": false,
            "searching": false,
            "ordering": false,
            "bFiltered": false,
            "bStateSave": true, // save datatable state(pagination, sort, etc) in cookie.
            "bProcessing": true,
            "bServerSide": true,
            "sAjaxSource": sSource,
            "fnServerData": retrieveData,
            "pagingType": "full_numbers",
            "aoColumns": [
                {
                    "mData": "id"
                },
                {
                    "mData": "sample_title"
                },
                {
                    "mData": "counts"
                }],
            "aoColumnDefs": [
                { // set default column settings
                    'visible': false,
                    'targets': [0]
                },{
                    "aTargets": [2],
                    "mData": "id",
                    "mRender": function (a, b, c, d) {//a表示id对应的值，c表示当前记录行对象
                        if(a==null){
                            return 0;
                        }else{
                            return a;
                        }
                    }
                }

            ]
        });
    }

    jQuery(document).ready(function () {
        seachTable();
        seachTable1();
    });

</script>
</body>
<!-- END BODY -->
</html>