我有一张图表。我想显示范围选择器,如http://www.highcharts.com/docs/chart-concepts/range-selector 我的代码:
$('#timeline').highcharts({
chart: {
type: 'columnrange',
inverted: true,
},
scrollbar: {
enabled: true
},
yAxis: {
labels: {
formatter: function() {
var $moment = moment(this.value);
return $moment.format("YYYY-MM-DD") + "<br/>("+ $moment.format("HH:mm:ss") + ")";
}
}
},
plotOptions: {
columnrange: {
grouping: false
}
},
rangeSelector: {
enabled: true
},
legend: {
enabled: true
},
tooltip: {
formatter: function () {
return '<b>' + this.x + ' - ' + this.series.name + '</b><br/>' +
moment(this.point.low).format("DD MMMM HH:mm:ss") + " - " +
moment(this.point.high).format("DD MMMM HH:mm:ss");
}
},
series: JSON.parse('[{"name":"200","data":[{"x":0,"low":1438974756000,"high":1438974945000},{"x":0,"low":1438975321000,"high":1438975573000},{"x":0,"low":1438975697000,"high":1438980175000},{"x":0,"low":1439016907000,"high":1439017219000}]},{"name":"404","data":[{"x":0,"low":1438975005000,"high":1438975133000}]},{"name":"503","data":[{"x":0,"low":1438975197000,"high":1438975258000}]},{"name":"500","data":[{"x":0,"low":1438975637000,"high":1438975637000},{"x":0,"low":1439016542000,"high":1439016846000}]}]');
});
但范围选择器不起作用。 我做错了什么?
答案 0 :(得分:0)
放:
allButtonsEnabled: true
在范围选择器中并尝试此操作。并在xAxis中设置最小日期:
min:Date.UTC(2015,0,1)