使用Highcharts绘制数据时出现问题

时间:2019-04-11 01:10:06

标签: javascript highcharts

我正在实现一个Highcharts图形,特别是这个https://www.highcharts.com/demo/line-basic,但是我需要显示一个带有日期的数量,在执行时,它会显示:

enter image description here

我只需要显示示例中的行

我该如何解决?我认为应该有一些选择避免被这种方式绘制

我的代码:

$.getJSON('assistants_status_by_event', function (data) {
        $('#assistants_status_by_event').highcharts({
            title: {
                text: ''
            },

            subtitle: {
                text: ''
            },
            xAxis: {
                type: 'datetime'
            },
            yAxis: {
                title: {
                    text: 'Numero de asistentes'
                }
            },
            legend: {
                layout: 'vertical',
                align: 'right',
                verticalAlign: 'middle'
            },

            plotOptions: {
                series: {
                    label: {
                        connectorAllowed: false
                    }
                }
            },

            series: [{
                type: 'area',
                name: 'Confirmados',
                data: data['confirmed'][0]['data']
            }, {
                type: 'area',
                name: 'Pendientes',
                data: data['pending'][0]['data']
            }],

            responsive: {
                rules: [{
                    condition: {
                        maxWidth: 500
                    },
                    chartOptions: {
                        legend: {
                            layout: 'horizontal',
                            align: 'center',
                            verticalAlign: 'bottom'
                        }
                    }
                }]
            }
        });
    });

我的数据:

enter image description here

0 个答案:

没有答案