From: Dan Vanderkam Date: Wed, 10 Nov 2010 16:08:59 +0000 (-0500) Subject: clean up X-Git-Tag: v1.0.0~611 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=1903f1e49133d38479059befb9dc50c7b622c826;p=dygraphs.git clean up --- diff --git a/docs/index.html b/docs/index.html index fe36356..811b7b7 100644 --- a/docs/index.html +++ b/docs/index.html @@ -853,7 +853,7 @@ perl -ne 'BEGIN{print "Month,Nominal,Real\n"} chomp; ($m,$cpi,$low,$close,$high) highlightCallback - function(event, x, points) + function(event, x, points,row) null When set, this callback gets called every time a new point is highlighted. The parameters are the JavaScript mousemove event, the x-coordinate of the highlighted points and an array of highlighted points: [ {name: 'series', yval: y-value}, … ]
Tests: callback crosshair
diff --git a/dygraph.js b/dygraph.js index 1f36f1c..5cfe2f4 100644 --- a/dygraph.js +++ b/dygraph.js @@ -1214,23 +1214,22 @@ Dygraph.prototype.mouseMove_ = function(event) { }; /** - * Transforms layout_.points index into data row number + * Transforms layout_.points index into data row number. * @param int layout_.points index - * @return int row number + * @return int row number, or -1 if none could be found. * @private */ Dygraph.prototype.idxToRow_ = function(idx) { - if(idx<0)return -1; - - for (var i in this.layout_.datasets) { - if (idx < this.layout_.datasets[i].length) { - return this.boundaryIds_[0][0]+idx; - } - idx-=this.layout_.datasets[i].length; - } - return -1; -} + if (idx < 0) return -1; + for (var i in this.layout_.datasets) { + if (idx < this.layout_.datasets[i].length) { + return this.boundaryIds_[0][0]+idx; + } + idx -= this.layout_.datasets[i].length; + } + return -1; +}; /** * Draw dots over the selectied points in the data series. This function