morrisjs 面积图不显示最后一个 xLabel

morrisjs Area graph not showing the last xLabel

这是我的代码:

 var months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
Morris.Area({
    element: 'chart_area',
    data: [{
        m: '2016-7',
        value: 19
    }, {
        m: '2016-6',
        value: 2
    }, {
        m: '2016-5',
        value: 3
    }],
    xkey: 'm',
    ykeys: ['value'],
    labels: ['Total Hit'],
    yLabelFormat: function(y) {
        return y != Math.round(y) ? '' : y;
    },
    xLabelFormat: function(x) {
        var month = months[x.getMonth()];
        return month;
    },
    dateFormat: function(x) {
        var month = months[new Date(x).getMonth()];
        return month;
    }
});

这是我创建的 fiddle。 7 月的 xLabel 结尾不见了。

如有任何帮助,我们将不胜感激。谢谢!

xLabels 选项添加到 Morris 初始化并将间隔设置为 'month',如下所示:

Morris.Area({
    ...
    xLabels: 'month',
    ...
});

这里是 fiddle 展示它的实际效果!