我正在使用highcharts股票图表similar to this。我的图表有数百个数据点。有没有办法在图表下方预先设置时间滑块?
假设我的X轴有100个数据点(日期时间,以秒为单位)。我想要图表的默认视图让选择器显示20个点。积分40-60
这是我正在使用的样本:
$(function () {
$('#container').highcharts('StockChart', {
rangeSelector: {
buttonTheme: { // styles for the buttons
fill: 'none',
stroke: 'none',
'stroke-width': 0,
r: 8,
style: {
color: '#039',
fontWeight: 'bold'
},
states: {
hover: {
},
select: {
fill: '#039',
style: {
color: 'white'
}
}
// disabled: { ... }
}
},
inputBoxBorderColor: 'gray',
inputBoxWidth: 120,
inputBoxHeight: 18,
inputStyle: {
color: '#039',
fontWeight: 'bold'
},
labelStyle: {
color: 'silver',
fontWeight: 'bold'
},
selected: 1
},
series: [{
name: 'USD to EUR',
data: usdeur
}]
});
});
答案 0 :(得分:1)
在此example中,StockChart正在绘制300点。接下来检索点[40]和[60]的时间戳,并调用setExtremes()
来设置底部导航器的最小和最大时间戳。