Highcharts奇怪的垂直线

时间:2018-01-02 23:25:42

标签: highcharts

我不明白为什么这种形式存在所有这些奇怪的垂直线:

weird graph

这是JS小提琴

https://jsfiddle.net/oz73d3gg/

代码:

Highcharts.chart('js-chart-rating-month', {

    credits: {
        enabled: false
    },

    title: {
        text: 'Ratings'
    },

    xAxis: {
        allowDecimals: false,

    },

    yAxis: {
        title: {
            text: 'Ratings'
        }
    },
    legend: {
        layout: 'vertical',
        align: 'right',
        verticalAlign: 'middle'
    },

    plotOptions: {
        series: {
            label: {
                connectorAllowed: true
            }

        }
    },

    series: [{
        name: 'Ratings',
        data: [[2006,9], [2007,6], [2007,8], [2008,9], [2009,9], [2009,7], [2009,9], [2009,10], [2010,9], [2010,9], [2010,10], [2010,8], [2011,8], [2011,8], [2011,10], [2011,5], [2011,9], [2011,9], [2012,10], [2012,9], [2012,9], [2012,10], [2012,10], [2013,9], [2013,9], [2013,9], [2013,9], [2014,8], [2014,10], [2014,10], [2015,9], [2015,9], [2015,8], [2015,10], [2015,8], [2016,10], [2016,10], [2016,9], [2016,9], [2016,10], [2016,10], [2016,8], [2017,10], [2017,9], [2017,10], [2017,9], [2017,10], [2017,8] ]
    }],

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

});

此外,这些图中似乎缺少这些点: Good Graph

有什么想法吗?我在这里画一个空白。

1 个答案:

答案 0 :(得分:1)

您在同一年拥有多个值,因此您必须清理data

series: [{
        name: 'Ratings',
        data: [... [2017,10], [2017,9], [2017,10], [2017,9], [2017,10], [2017,8] ] // Only 1 value for each year
    }],

Fiddle