<link rel="stylesheet" href="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/css/bootstrap-datepicker.standalone.min.css">
<script src="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
<script src="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>

<div class="content_wrapper">
    <div class="container-fluid">
        <aside>
            <header><i class="fa fa-fw fa-file"></i>早报</header>
            <section>
                <div class="container-fluid">
                    <div class="row">
                        <div class="col-sm-12">
                            <a style="margin:5px;" class="btn btn-primary " href="#statistics/report/" role="button">表格</a>
                            <a style="margin:5px;" class="btn btn-primary " href="#statistics/report/1" role="button">曲线图</a>
                        </div>
                    </div>
                </div>
            </section>
        </aside>
        <div class="row">
            <div class="col-sm-12">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>查询</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-12">
                                    <form class="form-inline" role="form" method="post" action="#statistics/report/1" >
                                        <span class="gap"></span>
                                        <div class="form-group">
                                            <label>开始时间</label>
                                            <input type="text" class="form-control datetimepicker" value="<?php if($stime) echo $stime;?>" placeholder="开始时间" name="stime" />
                                        </div
                                        <span class="gap"></span>
                                        <span class="gap"></span>
                                        <div class="form-group">
                                            <label>结束时间</label>
                                            <input type="text" class="form-control datetimepicker" value="<?php if($etime) echo $etime;?>" placeholder="结束时间" name="etime" />
                                        </div>
                                        <span class="gap"></span>
                                        <button type="submit" class="btn btn-primary" id="searchBtn">查询</button>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
            <div class="row">
                <div class="col-sm-6">
                    <aside>
                        <header><i class="fa fa-fw fa-file"></i>活跃&新增</header>
                        <section>
                            <div class="container-fluid">
                                <div class="row">
                                    <div id="container1" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
                                </div>
                            </div>
                        </section>
                    </aside>
                </div>
                <div class="col-sm-6">
                    <aside>
                        <header><i class="fa fa-fw fa-file"></i>游戏收入&广告收入</header>
                        <section>
                            <div class="container-fluid">
                                <div class="row">
                                    <div id="container2" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
                                </div>
                            </div>
                        </section>
                    </aside>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <aside>
                        <header><i class="fa fa-fw fa-file"></i>CPI</header>
                        <section>
                            <div class="container-fluid">
                                <div class="row">
                                    <div id="container3" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
                                </div>
                            </div>
                        </section>
                    </aside>
                </div>
                <div class="col-sm-6">
                    <aside>
                        <header><i class="fa fa-fw fa-file"></i>新增次留</header>
                        <section>
                            <div class="container-fluid">
                                <div class="row">
                                    <div id="container4" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
                                </div>
                            </div>
                        </section>
                    </aside>
                </div>
            </div>

    </div>
</div>
</div>
<script type="text/javascript" src="<?php echo base_url();?>public/js/highcharts/highcharts.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>public/js/highcharts/modules/exporting.js"></script>
<script type="text/javascript">
    Highcharts.chart('container1', {
        chart: {
            type: 'line'
        },
        title: {
            text: '活跃&新增'
        },
        subtitle: {
            text: ''
        },
        xAxis: {
            categories: [<?php echo "'".implode("','", array_column($data,'date'))."'";?>]
        },
        yAxis: {
            title: {
                text: '数值'
            }
        },
        plotOptions: {
            line: {
                dataLabels: {
                    enabled: true
                },
                enableMouseTracking: false
            }
        },
        series: [
            {
                name: '活跃',
                data: [<?php echo implode(",", array_column($data,'dau'));?>]
            },{
                name: '新增',
                data: [<?php echo implode(",", array_column($data,'new_player'));?>]
            }
        ]
    });
    Highcharts.chart('container2', {
        chart: {
            type: 'line'
        },
        title: {
            text: '游戏收入&广告收入'
        },
        subtitle: {
            text: ''
        },
        xAxis: {
            categories: [<?php echo "'".implode("','", array_column($data,'date'))."'";?>]
        },
        yAxis: {
            title: {
                text: '数值'
            }
        },
        plotOptions: {
            line: {
                dataLabels: {
                    enabled: true
                },
                enableMouseTracking: false
            }
        },
        series: [
            {
                name: '游戏内收入',
                data: [<?php echo implode(",", array_column($data,'revenue'));?>]
            },{
                name: '广告收入',
                data: [<?php echo implode(",", array_column($data,'ad_estimate_income'));?>]
            }
        ]
    });
    Highcharts.chart('container3', {
        chart: {
            type: 'line'
        },
        title: {
            text: 'CPI'
        },
        subtitle: {
            text: ''
        },
        xAxis: {
            categories: [<?php echo "'".implode("','", array_column($data,'date'))."'";?>]
        },
        yAxis: {
            title: {
                text: '数值'
            }
        },
        plotOptions: {
            line: {
                dataLabels: {
                    enabled: true
                },
                enableMouseTracking: false
            }
        },
        series: [
            {
                name: 'CPI',
                data: [<?php echo implode(",", array_column($data,'cpi_android'));?>]
            },{
                name: '广告安装',
                data: [<?php echo implode(",", array_column($data,'ad_android'));?>]
            },{
                name: '广告花费',
                data: [<?php echo implode(",", array_column($data,'adexpend_android'));?>]
            },
        ]
    });
    Highcharts.chart('container4', {
        chart: {
            type: 'line'
        },
        title: {
            text: '新增次留'
        },
        subtitle: {
            text: ''
        },
        xAxis: {
            categories: [<?php echo "'".implode("','", array_column($data,'date'))."'";?>]
        },
        yAxis: {
            title: {
                text: '数值'
            }
        },
        plotOptions: {
            line: {
                dataLabels: {
                    enabled: true
                },
                enableMouseTracking: false
            }
        },
        series: [
            {
                name: '新增次留',
                data: [<?php echo implode(",", array_column($data,'remain_new_last'));?>]
            }
        ]
    });
    //选择日期
    $('.datetimepicker').datepicker({
        language:'zh-CN',
        format:'yyyymmdd',
        zIndexOffset:906  //控制z-index
    });
</script>