<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">
        <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/todaySpinsAddLowSta" name="stanpform">
                                        <span class="gap"></span>
                                        <div class="form-group">
                                            <label>时间</label>
                                            <input type="text" class="form-control datetimepicker" value="<?php if($time) echo $time;?>" placeholder="开始时间" name="time" />
                                        </div>
                                        <span class="gap"></span>
                                        <div class="form-group">
                                            <label>对比时间</label>
                                            <input type="text" class="form-control datetimepicker" value="<?php if($time2) echo $time2;?>" placeholder="结束时间" name="time2" />
                                        </div>
                                        <span class="gap"></span>
                                        <div class="form-group">
                                            <label>开始等级</label>
                                            <input type="text" class="form-control datetimepicker" value="<?php if($start_level) echo $start_level;?>" placeholder="结束时间" name="start_level" />
                                        </div>
                                        <span class="gap"></span>
                                        <div class="form-group">
                                            <label>结束等级</label>
                                            <input type="text" class="form-control datetimepicker" value="<?php if($end_level) echo $end_level;?>" placeholder="结束时间" name="end_level" />
                                        </div>
                                        <button type="submit" class="btn btn-primary">查询</button>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>

        <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 id="chatSta" 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('chatSta', {
        chart: {
            type: 'column'
        },
        title: {
            text: '每日体力盈亏统计'
        },
        subtitle: {
            text: ''
        },
        xAxis: {
            categories: [<?php
                $lastMum = '<-50000';
                foreach($data['section'] as $endNum){
                    echo "'".$lastMum.'~'.$endNum."',";
                    $lastMum = $endNum;
                }
                ?>]
        },
        yAxis: [{ // Primary yAxis
            labels: {
                format: '{value}',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            },
            title: {
                text: '数值',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            }
        }, { // Primary yAxis
            labels: {
                format: '{value}',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            },
            title: {
                text: '数值',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            },
            opposite: true
        }, { // Primary yAxis
            labels: {
                format: '{value}',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            },
            title: {
                text: '数值',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            },
            opposite: true
        }],
        plotOptions: {
            line: {
                dataLabels: {
                    enabled: true
                },
                enableMouseTracking: false
            }
        },
        series: [
            {
                name:'人数',
                data:[<?php foreach ($data['sectionPeople'] as $key=>$num){
                    echo $num - abs($data2['sectionPeople'][$key]).",";
                } ?>]
            },{
                name:'人均',
                yAxis: 1,
                data:[<?php foreach ($data['sectionTotal'] as $key=>$num){
                    $temp = ((empty($data['sectionPeople'][$key])?0:($num / $data['sectionPeople'][$key])) - abs(empty($data2['sectionPeople'][$key])?0:($data2['sectionTotal'][$key] / $data2['sectionPeople'][$key]) ));
                    echo $temp;
                } ?>]
            },
            {
                name:'总变动',
                yAxis: 2,
                data:[<?php foreach ($data['sectionTotal'] as $key=>$num){
                    echo $num - abs($data2['sectionTotal'][$key]).",";
                } ?>]
            }
        ]
    });

</script>
<script type="text/javascript">
    //选择日期
    $('.datetimepicker').datepicker({
        language:'zh-CN',
        format:'yyyy-mm-dd',
        zIndexOffset:906  //控制z-index
    });
</script>