(由谷歌翻译)
如果点数量较少(或仅显示部分缩放),我的图表效果很好。但在这个例子中,有超过5000并且看起来不太好。
$(function () {
data = load();
$('#container').highcharts('StockChart', {
chart: {
zoomType: 'x'
},
rangeSelector: { enabled: false },
navigator: { enabled: false },
xAxis: {
type: 'datetime',
dateTimeLabelFormats: {
second: '%d/%m/%y',
minute: '%d/%m/%y',
hour: '%d/%m/%y',
day: '%d/%m/%y',
week: '%d/%m/%y',
month: '%d/%m/%y',
year: '%d/%m/%y'
},
},
yAxis: {
opposite: false,
gridLineDashStyle: 'Dot',
gridLineColor: '#CCCCCC',
min: -1,
max: 2,
labels: {
formatter: function() {
var lab = ['No OK', 'OK'];
return lab[this.value] || '';
}
}
},
series : [{
name : 'test',
turboThreshold: 6000,
marker : {
enabled : true,
radius : 2,
symbol: 'circle'
},
data : data
}]
});
});
function load(){
return [
{"x":1420167601000,"y":1},
{"x":1420167602000,"y":1},
{"x":1420167603000,"y":1},
{"x":1420167604000,"y":1},
{"x":1420167605000,"y":1},
{"x":1420167606000,"y":1},
{"x":1420167607000,"y":1},
{"x":1420167608000,"y":0},
{"x":1420167609000,"y":1},
{"x":1420167610000,"y":1},
{"x":1420167611000,"y":0},
{"x":1420167612000,"y":1},
...
... an so on ( for one year points ~5000 items ) ....
... 95% of them are 1. 5% of them are 0 ...
...
];
}
系列只能有值0或1
但是,您可以在图表中看到,看起来像0.9
为什么呢? 我需要尊重0和1的值
答案 0 :(得分:0)
我自己找到了答案。
问题是serie.dataGrouping配置。
在我的情况下,我需要它保持禁用状态,或启用近似值=低
然后:
...
series : [{
name : 'test',
turboThreshold: 6000,
dataGrouping: { enabled: false },
marker : {
enabled : true,
radius : 2,
symbol: 'circle'
},
data : data
}]
...