missing value in highcharts line graph results in no line, just points

时光毁灭记忆、已成空白 提交于 2019-11-30 11:38:18

You will need to change your missing values to null, and specify that you want a line/spline through the existing values.

var chart = new Highcharts.Chart({

    chart: {
        defaultSeriesType: 'line',
        renderTo: 'container'
    },

    xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    },

    series: [{
        data: [29.9, null, 106.4, 129.2, 144.0, 176.0, null, 148.5, 216.4, 194.1, 95.6, 54.4],
    }]

});

see http://jsfiddle.net/xynZT/ with defaultSeriesType: 'spline' as an example.

It's not displaying incorrectly its just plotting a scatter plot. I thinks this is because you don't have a complete series it will be treated like that. I possible, and this depends that your data doesn't use negative number, try to put the collection of no data a 0 such that you have data: [29.9, 0, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] and this will display a line.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!