X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;ds=sidebyside;f=dygraph.js;h=5cfe2f424e0ce7af87ab1b45c696dab168b119aa;hb=e1fb3740f1d27bbbb67fbf72e831a3b57bb20d91;hp=1f36f1c56e9d7bec4c97b1ea8241b11e42b50dc3;hpb=c2909c73e4f5b8acc7881ca51ce3ece7dbe4ed3e;p=dygraphs.git 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