From dcb25130b93f7d1ca126c01fb90f1b1aa413c54d Mon Sep 17 00:00:00 2001 From: Neal Nelson Date: Thu, 10 Feb 2011 12:17:21 +0100 Subject: [PATCH] Updated noZoomFlagChange related documentation. --- docs/index.html | 18 ++++++++++++++++++ dygraph.js | 16 +++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/docs/index.html b/docs/index.html index 48fbbb6..9e652b5 100644 --- a/docs/index.html +++ b/docs/index.html @@ -527,6 +527,17 @@ new Dygraph(el, data, {

The Tests for zoom operations show a full example of this in action.

+

Programmatic Zoom

+

+ When a chart is programmatically zoomed by updating either the dateWindow + or valueRange option, by default the zoomed flags are also updated correspondingly. + It is possible to prevent this by specifying the noZoomFlagChange in the same + call to the updateOptions method. +

+

+ The no-zoom-change test shows this in operation. +

+

One last demo

This chart shows monthly closes of the Dow Jones Industrial Average, both in nominal and real (i.e. adjusted for inflation) dollars. The shaded areas show its monthly high and low. CPI values with a base from 1982-84 are used to adjust for inflation.

@@ -736,6 +747,13 @@ perl -ne 'BEGIN{print "Month,Nominal,Real\n"} chomp; ($m,$cpi,$low,$close,$high) + + Changing either of two the above options will cause the corresponding zoom + flag (isZoomed()) to be set, unless the noZoomFlagChange + option is also specified. + + + labelsSeparateLines boolean false diff --git a/dygraph.js b/dygraph.js index b043d06..671de64 100644 --- a/dygraph.js +++ b/dygraph.js @@ -264,7 +264,15 @@ Dygraph.prototype.__init__ = function(div, file, attrs) { this.start_(); }; -// Axis is an optional parameter. Can be set to 'x' or 'y'. +/** + * Returns the zoomed status of the chart for one or both axes. + * + * Axis is an optional parameter. Can be set to 'x' or 'y'. + * + * The zoomed status for an axis is set whenever a user zooms using the mouse + * or when the dateWindow or valueRange are updated (unless the noZoomFlagChange + * option is also specified). + */ Dygraph.prototype.isZoomed = function(axis) { if (axis == null) return this.zoomed_x_ || this.zoomed_y_; if (axis == 'x') return this.zoomed_x_; @@ -3177,6 +3185,12 @@ Dygraph.prototype.start_ = function() { *
  • file: changes the source data for the graph
  • *
  • errorBars: changes whether the data contains stddev
  • * + * + * If the dateWindow or valueRange options are specified, the relevant zoomed_x_ + * or zoomed_y_ flags are set, unless the noZoomFlagChange option is also + * secified. This allows for the chart to be programmatically zoomed without + * altering the zoomed flags. + * * @param {Object} attrs The new properties and values */ Dygraph.prototype.updateOptions = function(attrs) { -- 2.7.4