highcharts rangeselectorを使用して作業するjQueryの日付ピッカーを取得するにはどうすればよいですか?jQuery datepicker with Highstocks/Highcharts
このフィドルは、問題を抱えている(ハイチャートの著者からの)古い例です。
終了日を変更すると、データの先頭に開始日をリセットします。
$(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