How can I get a working jQuery datepicker with highcharts rangeselector?
This fiddle is an old example (from a highcharts author) which has the problem.
Changing the end date will reset the start date to the beginning of the data.
$(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();
}
});
});
perhaps this will help
Change range in Highstock dynamically
I be able to update configuration of the displayed chart on the fly by accessing axis objects.
You could set extremes once a date is selected, using your onSelect event and removing this.onchange().
Example:
http://jsfiddle.net/BWEm5/542/