From: Klaus Weidner Date: Mon, 27 Feb 2012 18:31:16 +0000 (-0800) Subject: Change option to highlightSeriesBackgroundAlpha X-Git-Tag: v1.0.0~314^2~15^2 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=afdb20d88ecfd0d3464adf2ca7a8f87d7935409b;p=dygraphs.git Change option to highlightSeriesBackgroundAlpha This is 1 - highlightSeriesBackgroundFade (using the old option), and hopefully more intuitive. --- diff --git a/auto_tests/tests/callback.js b/auto_tests/tests/callback.js index aad0dad..fe7f7fd 100644 --- a/auto_tests/tests/callback.js +++ b/auto_tests/tests/callback.js @@ -167,7 +167,7 @@ var runClosestTest = function(isStacked, widthNormal, widthHighlighted) { strokeWidth: widthNormal, strokeBorderWidth: 2, highlightCircleSize: widthNormal * 2, - highlightSeriesBackgroundFade: 0.7, + highlightSeriesBackgroundAlpha: 0.3, highlightSeriesOpts: { strokeWidth: widthHighlighted, diff --git a/dygraph-options-reference.js b/dygraph-options-reference.js index bc5867e..cb8b767 100644 --- a/dygraph-options-reference.js +++ b/dygraph-options-reference.js @@ -145,11 +145,11 @@ Dygraph.OPTIONS_REFERENCE = // "type": "Object", "description": "When set, the options from this object are applied to the timeseries closest to the mouse pointer for interactive highlighting. See also 'highlightCallback'. Example: highlightSeriesOpts: { strokeWidth: 3 }." }, - "highlightSeriesBackgroundFade": { + "highlightSeriesBackgroundAlpha": { "default": "0.5", "labels": ["Interactive Elements"], "type": "float", - "description": "When nonzero, dim the background while highlighting series. 0=fully visible background, 1=hiddden background (show highlighted series only)." + "description": "Fade the background while highlighting series. 1=fully visible background (disable fading), 0=hiddden background (show highlighted series only)." }, "includeZero": { "default": "false", diff --git a/dygraph.js b/dygraph.js index 298f64b..9979587 100644 --- a/dygraph.js +++ b/dygraph.js @@ -187,7 +187,7 @@ Dygraph.dateAxisFormatter = function(date, granularity) { Dygraph.DEFAULT_ATTRS = { highlightCircleSize: 3, highlightSeriesOpts: null, - highlightSeriesBackgroundFade: 0.5, + highlightSeriesBackgroundAlpha: 0.5, labelsDivWidth: 250, labelsDivStyles: { @@ -1885,7 +1885,7 @@ Dygraph.prototype.updateSelection_ = function(opt_animFraction) { var ctx = this.canvas_ctx_; if (this.attr_('highlightSeriesOpts')) { ctx.clearRect(0, 0, this.width_, this.height_); - var alpha = this.attr_('highlightSeriesBackgroundFade'); + var alpha = 1.0 - this.attr_('highlightSeriesBackgroundAlpha'); if (alpha) { // Activating background fade includes an animation effect for a gradual // fade. TODO(klausw): make this independently configurable if it causes