this.annotations_ = [];
// Zoomed indicators - These indicate when the graph has been zoomed and on what axis.
- this.zoomed = false;
- this.zoomedX = false;
- this.zoomedY = false;
+ this.zoomed_x_ = false;
+ this.zoomed_y_ = false;
// Clear the div. This ensure that, if multiple dygraphs are passed the same
// div, then only one will be drawn.
this.start_();
};
+// axis is an optional parameter. Can be set to 'x' or 'y'.
+Dygraph.prototype.isZoomed = function(axis) {
+ if (axis == null) return this.zoomed_x_ || this.zoomed_y_;
+ if (axis == 'x') return this.zoomed_x_;
+ if (axis == 'y') return this.zoomed_y_;
+ throw "axis parameter to Dygraph.isZoomed must be missing, 'x' or 'y'.";
+};
+
Dygraph.prototype.attr_ = function(name, seriesName) {
if (seriesName &&
typeof(this.user_attrs_[seriesName]) != 'undefined' &&
*/
Dygraph.prototype.doZoomXDates_ = function(minDate, maxDate) {
this.dateWindow_ = [minDate, maxDate];
- this.zoomed = true;
- this.zoomedX = true;
+ this.zoomed_x_ = true;
this.drawGraph_();
if (this.attr_("zoomCallback")) {
var yRange = this.yAxisRange();
valueRanges.push([low[1], hi[1]]);
}
- this.zoomed = true;
- this.zoomedY = true;
+ this.zoomed_y_ = true;
this.drawGraph_();
if (this.attr_("zoomCallback")) {
var xRange = this.xAxisRange();
if (dirty) {
// Putting the drawing operation before the callback because it resets
// yAxisRange.
- this.zoomed = false;
- this.zoomedX = false;
- this.zoomedY = false;
+ this.zoomed_x_ = false;
+ this.zoomed_y_ = false;
this.drawGraph_();
if (this.attr_("zoomCallback")) {
var minDate = this.rawData_[0][0];
showDimensions(a,b,c,d);
},
drawCallback: function(me, initial) {
- document.getElementById("zoomed").innerHTML = me.zoomed ? "True" : "False";
- document.getElementById("zoomedX").innerHTML = me.zoomedX ? "True" : "False";
- document.getElementById("zoomedY").innerHTML = me.zoomedY ? "True" : "False";
+ document.getElementById("zoomed").innerHTML = "" + me.isZoomed();
+ document.getElementById("zoomedX").innerHTML = "" + me.isZoomed("x");
+ document.getElementById("zoomedY").innerHTML = "" + me.isZoomed("y");
}
}
);