<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>
<style type="text/css">
    .col-xs-5ths {
        border: solid lightgray 1px;
        width: 16.66%;
        float:left;
        border-left:none;
        text-align: center;
        height: 110px;
        border-bottom: none;
    }
    .col-xs-5ths:first-child {
        border-left:solid lightgray 1px;
    }
    .header-data {
        font-size: 35px;
        font-weight: 500;
    }
    .col-xs-5ths label {
        font-weight: 500;
        font-size: 18px;
        margin-bottom: 0;
        margin-top:10px;
    }
    .second-row > .col-xs-5ths {
        border-bottom: solid lightgray 1px;
    }
    .section-first {
        margin-left: 15px;
        margin-right: 15px;
    }
    .chart-pos {
        margin-right: -65%;
    }

    @media screen and (max-width:700px) {
        .col-xs-5ths {
            position: relative;
        }
        .col-xs-5ths label {
            font-size: 1rem;
        }

        .header-data {
            font-size: 1.5rem;
            font-weight: bold;
            margin-top: 1rem;
        }

        .chart-pos {
            position: absolute;
            bottom: 9%;
        }
    }
</style>
<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">
                            <form class="form-inline" role="form" method="POST" action="#statistics/spinsAddRank" name="stanpform">
                                <input type="hidden" value="1" name="payuserpost"/>
                                <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="payuserindex_stime" />
                                </div>
                                
                                <button type="submit" class="btn btn-primary">查询</button>
                            </form>
                        </div>
                    </div>
                </div>
            </section>
        </aside>
        <div class="row">
            <div class="col-sm-6">
                <aside>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-12">
                                    <aside>
                                        <section>
                                            <div class="container-fluid">
                                                <div class="row">
                                                    <div id="money"></div>
                                                </div>
                                            </div>
                                        </section>
                                    </aside>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
            <div class="col-sm-6">
                <aside>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-12">
                                    <aside>
                                        <section>
                                            <div class="container-fluid">
                                                <div class="row">
                                                    <div id="star"></div>
                                                </div>
                                            </div>
                                        </section>
                                    </aside>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </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">
    $("#money").css("height",($("#money").height() + 2000) + "px");
    $("#money").css("width",$("#money").width() + "px");
    Highcharts.chart('money', {
        chart: {
            type: 'bar'
        },
        title: {
            text: '体力发放排行榜 非付费'
        },
        subtitle: {
            text: '数据来源: Wikipedia.org'
        },
        xAxis: {
            categories: [<?php echo $unpay_rank['uid'] ?>],
            title: {
                text: null
            }
        },
        yAxis: {
            min: 0,
            title: {
                text: '',
                align: 'high'
            },
            labels: {
                overflow: 'justify'
            }
        },
        tooltip: {
            valueSuffix: ''
        },
        plotOptions: {
            bar: {
                dataLabels: {
                    enabled: true,
                    allowOverlap: true // 允许数据标签重叠
                }
            }
        },
        legend: {
            layout: 'vertical',
            align: 'right',
            verticalAlign: 'top',
            x: -40,
            y: 100,
            floating: true,
            borderWidth: 1,
            backgroundColor: ((Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'),
            shadow: true
        },
        series: [{
            name: '体力',
            data: [<?php echo $unpay_rank['spins'] ?>],
            events: {
                click: function(event) {
                    window.open("#user/index/"+this.data[event.point.x].category,"_blank");
                }
            }
        }]
    }, function(chart) { // 图表渲染完毕后的回调函数
        var xAxis = chart.xAxis[0];
        console.log(xAxis);
        Highcharts.addEvent(xAxis.axisGroup.element, 'click', function(e) {
            //触发Y轴标题点击事件，以下忽略
            console.log(e)
        });
    });
    $("#star").css("height",($("#star").height() + 2000) + "px");
    $("#star").css("width",$("#star").width() + "px");
    Highcharts.chart('star', {
        chart: {
            type: 'bar'
        },
        title: {
            text: '体力发放排行榜 付费'
        },
        xAxis: {
            categories: [<?php echo $pay_rank['uid'] ?>],
            title: {
                text: null
            }
        },
        yAxis: {
            min: 0,
            title: {
                text: '',
                align: 'high'
            },
            labels: {
                overflow: 'justify'
            }
        },
        plotOptions: {
            bar: {
                dataLabels: {
                    enabled: true,
                    allowOverlap: true // 允许数据标签重叠
                }
            }
        },
        legend: {
            layout: 'vertical',
            align: 'right',
            verticalAlign: 'top',
            x: -40,
            y: 100,
            floating: true,
            borderWidth: 1,
            backgroundColor: ((Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'),
            shadow: true
        },
        series: [{
            name: '体力',
            data: [<?php echo $pay_rank['spins'] ?>],
            events: {
                click: function(event) {
                    window.open("#user/index/"+this.data[event.point.x].category,"_blank");
                }
            }
        }]
    });

</script>

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