如何指示空值,但不要在Highcharts Line graph中连接它?
问题描述:
我想指出图中存在空值。如何指示空值,但不要在Highcharts Line graph中连接它?
我想用0替换null,但是,它会连接其余的实际数据,并绘制不正确的图形。是否有可能不将零值与其余数据点连接?
另外,是否有可能使用图上显示的空白区域来指示空值?
var categoryText= ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
Highcharts.stockChart('container',{
chart: {
defaultSeriesType: 'spline',
renderTo: 'container'
},
xAxis: {
labels: {
formatter: function() {
return categoryText[this.value];
}
}
},
plotOptions: {
series: {
marker: {
enabled: true
}
}
},
series: [{
data: [29.9, null, 106.4, 129.2, 144.0, 176.0, null, 148.5, 216.4, 194.1, 95.6, 54.4],
}]
});
答
如果你在上面声明的数据,那么你可以试试这个只包括了null
阴谋乐队。我试着调整每个tick的偏移量到月中,但似乎有点不准确。请根据您的喜好调整。看看小提琴。
plotBands: data.map(function(item, index) {
return { color: 'orange', from: index-0.5, to: index+0.5, data: item }
}).filter(function(item) { return item.data === null})
},
所以,你要显示与橙色条空值? –
@NanduKalidindi不是酒吧,我在想情节带。 – devN