X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph.js;h=7dab8c7915db38d23a6df5ae69987bf8836e946c;hb=450fe64bf99f75ded58bdd34db55fd5fbbe1bb3f;hp=4adb7164760aca3d0a0d540d4e6cfb9572c21f74;hpb=e99fde0585bfc07ff26c9dc3a5ca30ea339cc81f;p=dygraphs.git diff --git a/dygraph.js b/dygraph.js index 4adb716..7dab8c7 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);