Good, therefore, after repeatedly digging the code, there really is no easy way to get this data, but there is a way.
In the solution below, I have a zoomChart jqPLot obj object that acts like a zoom proxy for my main jqPLot called chart . Presumably if you don't have a proxy, this should work just as well if you are attached to the right object.
What I'm doing is binding the custom function to the jqplotZoom event, which is fired after the zoom action completes.
zoomChart.target.bind('jqplotZoom', function(ev, gridpos, datapos, plot, cursor){ var plotData = plot.series[0].data; for (var i=0; i< plotData.length; i++) { if(plotData[i][0] >= chart.axes.xaxis.min && plotData[i][0] <= chart.axes.xaxis.max ) { //this dataset from the original is within the zoomed region //You can save these datapoints in a new array //This new array will contain your zoom dataset //for ex: zoomDataset.push(plotData[i]); } } });
It makes sense? In essence,
chart.axes.xaxis contains the boundaries of the enlarged area, and
plot.series[N].data contains all of your source data in chart format.
Please note that I used chart because I originally created var chart = $.jqplot("chartDiv", ...
You must use any variable name you gave to your plot. Hope this helps!
Java drinker
source share