在highstock范围选择器中,我添加了一个自定义范围选择器按钮(名为:my dates),并希望在调用此按钮时设置自定义极限.我知道如果你把简单的按钮放在图表外面并调用:chart.xAxis [0] .setExtremes(30,80);.
但我的情况不同我想在"1m 1y All"范围选择器按钮旁边添加一个按钮,并希望该新按钮设置自定义极值日期.使用xAxis事件setExtremes似乎不起作用,除非我遗漏了一些东西.http://jsfiddle.net/Aeaz3/1/
$(function() {
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=?', function(data) {
// Create the chart
$('#container').highcharts('StockChart', {
rangeSelector: {
buttons: [{
type: '',
count: 2,
text: 'My dates'
},{
type: 'hour',
count: 1,
text: '1h'
}, {
type: 'day',
count: 1,
text: '1d'
}, {
type: 'month',
count: 1,
text: '1m'
}, {
type: 'year',
count: 1,
text: '1y'
}, {
type: 'all',
text: 'All'
}],
},
title : {
text : 'AAPL Stock Price'
},
xAxis: { …Run Code Online (Sandbox Code Playgroud)