如何獲得帶有highcharts rangeselector的工作jQuery datepicker?與Highstocks/Highcharts jQuery日期選擇器
這個小提琴是一個古老的例子(來自高層作家),它有問題。
更改結束日期將重置起始日期到數據的開頭。
$(function() {
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=?', function(data) {
// Create the chart
window.chart = new Highcharts.StockChart({
chart: {
renderTo: 'container'
},
rangeSelector: {
selected: 1,
inputDateFormat: '%Y-%m-%d'
},
title: {
text: 'AAPL Stock Price'
},
series: [{
name: 'AAPL',
data: data,
tooltip: {
valueDecimals: 2
}}]
}, function(chart) {
// apply the date pickers
setTimeout(function() {
$('input.highcharts-range-selector', $('#' + chart.options.chart.renderTo)).datepicker()
}, 0)
});
});
// Set the datepicker's date format
$.datepicker.setDefaults({
dateFormat: 'yy-mm-dd',
onSelect: function(dateText) {
this.onchange();
this.onblur();
}
});
});
這個問題似乎是特定於highcharts/highstock的最新版本(5.0.0)。如果我指向一個特定的舊版本(4.2.2),那麼問題就會消失。 – user1984528