[英]Highchart range selector doesn't show up
在過去的幾個小時里,我在Highcharts中苦苦掙扎。 我啟用了:input和allButtons,但這沒有幫助。 另外,我將x軸的min和max以及x軸的min范圍也放了,仍然沒有運氣。 這是我的圖形初始化:
PS dataPreparedForGraph是包含javascript日期和一些值的一系列元素。
Highcharts.setOptions({
global: {
useUTC: false
}
});
Highcharts.chart('graph', {
chart: {
type: 'scatter',
zoomType: 'x',
panning: true,
panKey: 'shift'
},
title: {
text: tableName
},
xAxis: {
type: 'datetime',
dateTimeLabelFormats: {
month: '%e. %b',
year: '%b'
},
title: {
text: 'Date'
},
min: timestamp_label[0].getTime(),
max: timestamp_label[timestamp_label.length - 1].getTime(),
minRange: 3600
},
yAxis: {
title: {
text: 'Sensor value'
}
},
tooltip: {
headerFormat: '<b>{series.name}</b><br>',
pointFormat: '{point.x:%e. %b}: {point.y:.2f} m'
},
plotOptions: {
columnrange: {
grouping: false
},
series: {
marker: {
enabled: true
},
}
},
rangeSelector: {
enabled: true,
inputEnabled: true,
allButtonsEnabled: true,
buttons: [
{
type: 'minute',
count: 1,
text: 'minute'
},{
type: 'hour',
count: 1,
text: 'hour'
},{
type: 'day',
count: 1,
text: 'day'
}, {
type: 'week',
count: 1,
text: 'week'
}],
buttonTheme: {
width: 60
},
selected: 2
},
series: dataPreparedForGraph
});
范圍選擇器僅適用於Highstock。
要使用它,您需要更改源代碼:
<script src="https://code.highcharts.com/stock/highstock.js"></script>
並使用stockChart
構造函數:
Highcharts.stockChart('graph', {...});
現場演示: http : //jsfiddle.net/BlackLabel/mtkcg6aj/
文件: https : //www.highcharts.com/docs/stock/understanding-highstock
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.