<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">
                            <a style="margin:5px;" class="btn btn-primary active" href="#rank/index" role="button">总排行榜</a>
                            <a style="margin:5px;" class="btn btn-primary " href="#rank/day" role="button">每日排行榜</a>
                        </div>
                        <div class="col-sm-12">
                            <a style="margin:5px;" class="btn btn-success <?php if($sid == 999){echo 'active';}?>" href="#rank/index/999" role="button">全部</a>
                            <a style="margin:5px;" class="btn btn-success <?php if($sid == 1){echo 'active';}?>" href="#rank/index/1" role="button">安卓</a>
                            <a style="margin:5px;" class="btn btn-success <?php if($sid == 2){echo 'active';}?>" href="#rank/index/2" role="button">苹果</a>
                        </div>
                    </div>
                </div>
            </section>
        </aside>
        <div class="row">
            <div class="col-sm-4">
                <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-4">
                <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 class="col-sm-4">
                <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="level"></div>
                                                </div>
                                            </div>
                                        </section>
                                    </aside>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
            <div class="col-sm-4">
                <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="spins"></div>
                                                </div>
                                            </div>
                                        </section>
                                    </aside>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
            <div class="col-sm-4">
                <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="diamond"></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 $money['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 $money['money'] ?>],
            events: {
                click: function(event) {
                    var uid = this.data[event.point.x].category;
                	uid = uid.replace( /\(\*\)/g, '');
                    window.open("#user/index/"+uid,"_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 $star['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 $star['star'] ?>],
            events: {
                click: function(event) {
                    var uid = this.data[event.point.x].category;
                	uid = uid.replace( /\(\*\)/g, '');
                    window.open("#user/index/"+uid,"_blank");
                }
            }
        }]
    });
	
	$("#level").css("height",($("#level").height() + 2000) + "px");
    $("#level").css("width",$("#level").width() + "px");
    Highcharts.chart('level', {
        chart: {
            type: 'bar'
        },
        title: {
            text: '等级排行榜'
        },
        xAxis: {
            categories: [<?php echo $level['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: false
        // },
        series: [{
            name: '等级',
            data: [<?php echo $level['level'] ?>],
            events: {
                click: function(event) {
                    var uid = this.data[event.point.x].category;
                	uid = uid.replace( /\(\*\)/g, '');
                    window.open("#user/index/"+uid,"_blank");
                }
            }
        }]
    });

    $("#spins").css("height",($("#spins").height() + 2000) + "px");
    $("#spins").css("width",$("#spins").width() + "px");
    Highcharts.chart('spins', {
        chart: {
            type: 'bar'
        },
        title: {
            text: '体力排行榜'
        },
        xAxis: {
            categories: [<?php echo $spins['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 $spins['spins'] ?>],
            events: {
                click: function(event) {
                    var uid = this.data[event.point.x].category;
                	uid = uid.replace( /\(\*\)/g, '');
                    window.open("#user/index/"+uid,"_blank");
                }
            }
        }]
    });
    
    $("#diamond").css("height",($("#diamond").height() + 2000) + "px");
    $("#diamond").css("width",$("#diamond").width() + "px");
    Highcharts.chart('diamond', {
        chart: {
            type: 'bar'
        },
        title: {
            text: '钻石排行榜'
        },
        xAxis: {
            categories: [<?php echo $diamond['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 $diamond['diamond'] ?>],
            events: {
                click: function(event) {
                    var uid = this.data[event.point.x].category;
                	uid = uid.replace( /\(\*\)/g, '');
                    window.open("#user/index/"+uid,"_blank");
                }
            }
        }]
    });
</script>
