
<div class="content_wrapper">
    	<div class="container-fluid">
        <div class="row">
            <div class="col-sm-12">
                <aside>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-12">
                                    <a style="margin:5px;" class="btn btn-success <?php if($type == ''){echo 'active';}?>" href="#statistics/cardGrantSta" role="button">全部</a>
                                    <a style="margin:5px;" class="btn btn-success <?php if($type == 'cardGold'){echo 'active';}?>" href="#statistics/cardGrantSta/cardGold" role="button">金卡</a>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
                <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/cardGrantSta/<?php echo $type; ?>" name="stanpform">
		                                <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="time" />
		                                </div>
		                                
		                                <button type="submit" class="btn btn-primary">查询</button>

                                        <button type="button" class="btn btn-success" id="exportAllData">导出数据</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="container" style="min-width: 310px; height: 600px; margin: 0 auto"></div>
                            </div>
                        </div>
                    </section>
                    <?php if(empty($uid)){ ?>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div id="container2" style="min-width: 310px; height: 600px; margin: 0 auto"></div>
                            </div>
                        </div>
                    </section>

                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div id="container3" style="min-width: 310px; height: 600px; margin: 0 auto"></div>
                            </div>
                        </div>
                    </section>
                    <?php }     ?>
                </aside>
            </div>
        </div>
    </div>
</div>
</div>
<!--<script type="text/javascript" src="--><?php //echo base_url();?><!--public/js/highcharts/highcharts.js"></script>-->
<script src="https://code.highcharts.com.cn/highstock/highstock.js"></script>
<script src="https://code.highcharts.com/modules/data.js"></script>
<script src="https://code.highcharts.com/modules/heatmap.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>public/js/highcharts/modules/exporting.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>public/js/highcharts/modules/export-data.js"></script>
<script type="text/javascript">

    $(document).on("click","#exportAllData",function(){
        window.location.href = '/Export/cardGrantSta/<?php echo empty($type)?'card':$type; ?>/<?php echo $stime; ?>';
    });
//设置图表导出格式选项
Highcharts.setOptions({
    lang: {
        printChart: '打印图表',
        downloadJPEG: '下载 JPEG 文件',
        downloadPDF: '下载 PDF   文件',
        downloadPNG: '下载 PNG  文件',
        downloadSVG: '下载 SVG  文件',
        downloadCSV: '下载 CSV  文件',
        downloadXLS: '下载 XLS   文件',
        viewData: '查看数据表格'
    },
    navigation: {
        menuItemStyle: {
            padding: '6px 14px'
        }
    },
    exporting: {
        url: ''
    },
    credits: {
        text: '',
        url: ''
    }
});

    Highcharts.chart('container', {
        chart: {
            type: 'column'
        },
        title: {
            text: '发放量'
        },
        xAxis: {
            type: 'category',
            labels: {
                rotation: -45  // 设置轴标签旋转角度
            },
            scrollbar: {
                enabled: true
            },
            min: 0,
            max: 70,
        },
        yAxis: {
            min: 0,
            title: {
                text: '发放量(张)'
            }
        },
        legend: {
            enabled: false
        },
        tooltip: {
            formatter: function () {
                return '<b>' + this.series.name + '：</b><br/>' + this.point.y + '张'
                    +'<br/></b>卡片ID：'+this.series.userOptions.data[this.point.x][2]
                    +'<br/></b>卡片名称：'+this.series.userOptions.data[this.point.x][3];
            }
        },
        series: [{
            name: '发放量',
            data: [
                <?php foreach ($card as $k => $row){
                $row['ci_name_zh'] = (str_replace(["\n","\\n","\r","
                    "],"",$row['ci_name_zh']));
                    echo "['".$row['ci_name_zh']."[".$row['ciid']."]"."',".(empty($data[$row['ciid']])?0:$data[$row['ciid']]).",{$row['ciid']},'{$row['ci_name_zh']}'],";
                } ?>
            ],
            // dataLabels: {
            //     enabled: true,
            //     rotation: -90,
            //     color: '#FFFFFF',
            //     align: 'right',
            //     format: '{point.y}', // :.1f 为保留 1 位小数
            //     y: 10
            // }
        }]
    });

</script>