From: Dan Vanderkam Date: Mon, 1 Jul 2013 03:03:43 +0000 (-0400) Subject: light refactoring -- expose public hairlines X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=486e7893b37634b0b55246c758a6ea43354f6a84;p=dygraphs.git light refactoring -- expose public hairlines --- diff --git a/extras/hairlines.js b/extras/hairlines.js index fb05058..2d72036 100644 --- a/extras/hairlines.js +++ b/extras/hairlines.js @@ -210,7 +210,7 @@ hairlines.prototype.updateHairlineInfo = function() { that.divFiller_(h.infoDiv, { closestRow: row, points: selPoints, - hairline: h, + hairline: that.createPublicHairline_(h), dygraph: g }); } else { @@ -313,6 +313,17 @@ hairlines.prototype.destroy = function() { */ /** + * @param {!Hairline} h Internal hairline. + * @return {!PublicHairline} Restricted public view of the hairline. + */ +hairlines.prototype.createPublicHairline_ = function(h) { + return { + xval: h.xval, + interpolated: h.interpolated + }; +}; + +/** * @return {!Array.} The current set of hairlines, ordered * from back to front. */ @@ -320,10 +331,7 @@ hairlines.prototype.get = function() { var result = []; for (var i = 0; i < this.hairlines_.length; i++) { var h = this.hairlines_[i]; - result.push({ - xval: h.xval, - interpolated: h.interpolated - }); + result.push(this.createPublicHairline_(h)); } return result; };