Reputation: 267
Im working on a chart that has multiple data sources that dynamically load based on a zoomed range, but for some reason the chart "selection" event never passes an xAxis so I can get the range of the selection to then reload the data for the appropriate zoom-level. Since what I was trying to do was a little complex to debug, I reduced the case to a single static dataset that only performs a console.log(e) on the selection event. My distilled example is here:
When I do a selection on this sample chart, nothing zooms and the JavaScript Console shows the event has the xAxis and yAxis arrays, but the xAxis is 0-length and the yAxis is 1-length.
I see the check in the examples all the time:
if (e.xAxis[0]) {
//do stuff
}
So obviously there are situations where the xAxis would not be passed. Am I doing something to trigger such a situation? I know I must have done something wrong, but I cant for the life of me figure out what.
Upvotes: 0
Views: 967
Reputation: 2197
The problem is that your min and max values are not numbers but date strings. When casting them to timestamp numbers, it works.
var start = +new Date(2013, 1, 12, 0, 0, 0, 0);
var end = +new Date(2013, 1, 14, 0, 0, 0, 0);
Upvotes: 1
Reputation: 28528
Problem is you set:
xAxis: {
type: 'datetime',
min: start,
max: end,
minRange: 3600000
},
which set min and max values which does not let chart zoom as it already define min and max values.
Upvotes: 1