From: Dan Vanderkam Date: Wed, 29 Sep 2010 15:55:35 +0000 (+0200) Subject: Merge branch 'master' into per_series X-Git-Tag: v1.0.0~648 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=230b34614d5f8e1395e1b142789a40a772642799;hp=129569a500ce90f2b3d210791c53b09f53dda8de;p=dygraphs.git Merge branch 'master' into per_series --- diff --git a/dygraph.js b/dygraph.js index edc3eea..517f0c6 100644 --- a/dygraph.js +++ b/dygraph.js @@ -240,8 +240,12 @@ Dygraph.prototype.__init__ = function(div, file, attrs) { this.start_(); }; -Dygraph.prototype.attr_ = function(name) { - if (typeof(this.user_attrs_[name]) != 'undefined') { +Dygraph.prototype.attr_ = function(name, series) { + if (series && + typeof(this.user_attrs_[series]) != 'undefined' && + typeof(this.user_attrs_[series][name]) != 'undefined') { + return this.user_attrs_[series][name]; + } else if (typeof(this.user_attrs_[name]) != 'undefined') { return this.user_attrs_[name]; } else if (typeof(this.attrs_[name]) != 'undefined') { return this.attrs_[name]; @@ -1581,8 +1585,6 @@ Dygraph.prototype.drawGraph_ = function(data) { this.setColors_(); this.attrs_['pointSize'] = 0.5 * this.attr_('highlightCircleSize'); - var connectSeparatedPoints = this.attr_('connectSeparatedPoints'); - // Loop over the fields (series). Go from the last to the first, // because if they're stacked that's how we accumulate the values. @@ -1593,6 +1595,8 @@ Dygraph.prototype.drawGraph_ = function(data) { for (var i = data[0].length - 1; i >= 1; i--) { if (!this.visibility()[i - 1]) continue; + var connectSeparatedPoints = this.attr_('connectSeparatedPoints', i); + var series = []; for (var j = 0; j < data.length; j++) { if (data[j][i] != null || !connectSeparatedPoints) { @@ -2306,6 +2310,9 @@ Dygraph.prototype.updateOptions = function(attrs) { if (attrs.valueRange) { this.valueRange_ = attrs.valueRange; } + + // TODO(danvk): validate per-series options. + Dygraph.update(this.user_attrs_, attrs); Dygraph.update(this.renderOptions_, attrs);