From 1903f1e49133d38479059befb9dc50c7b622c826 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Wed, 10 Nov 2010 11:08:59 -0500 Subject: [PATCH] clean up --- docs/index.html | 2 +- dygraph.js | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 13 deletions(-) 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 -- 2.7.4