图片描述

<!-- 搜索表单  -->
...


<div id="show-statistical"></div>



<script src="/snsshop_admin/js/libs/highcharts/highcharts.js"></script>
<script src="/snsshop_admin/js/libs/highcharts/exporting.js"></script>
<script type="text/javascript" src="/snsshop_admin/js/libs/datePicker/WdatePicker.js"></script>


<

script>
   var chart = new Highcharts.Chart({
        chart: {
            renderTo: 'show-statistical',
            type: 'line',
            // marginRight: 30,
            // marginBottom: 25
        },
        title: {
            text: '',
            x: -20 //center
        },
        subtitle: {
            text: '',
            x: -20
        },
        xAxis: {
            categories: [],
        },
        yAxis: {
            title: {
                text: ''
            },
            plotLines: [{
                value: 0,
                width: 1,
                color: '#808080'
            }]
        },
        tooltip: {
            valueSuffix: ''
        },
        legend: {
            layout: 'vertical',
            align: 'right',
            verticalAlign: 'middle',
            borderWidth: 0
        },
        series: [{
            name: '会员新增统计',
            data: []
        }, {
            name: '会员充值统计',
            data: []
        }]
    });



$("#select-users").submit(function(event) {
    event.preventDefault();
    $.post('/snsshop_admin/managers/statistical', $("#select-users").serialize(), function(data) {
        // 返回一个 JSON
        chart.xAxis[0].setCategories(data[0]);
        chart.series[0].setData(data[1]);
        chart.series[1].setData(data[2]);
    },'json');
    return false;
});
// 默认自动提交
$("#select-users").submit();

参考资料:
Highcharts set x-axis categories


forecho
352 声望9 粉丝

Yiier [链接]


引用和评论

0 条评论