You want to call the xAxisRange
method, which returns a pair of timestamps for the visible range. If you want to get a notification when the user zooms, use a zoomCallback
. zoomCallbacks get some parameters indicating the visible range.
g = new Dygraph(div, data, {
zoomCallback: function(minX, maxX, yRanges) {
console.log("Zoomed to [", minX, ", ", maxX, "]");
}
});
g.ready(function() {
console.log("Data loaded. x-axis range is:", g.xAxisRange());
});