<tr>
<td><strong>highlightCallback</strong></td>
- <td><code>function(event, x, points)</code></td>
+ <td><code>function(event, x, points,row)</code></td>
<td><code>null</code></td>
<td>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: <code>[ {name: 'series', yval: y-value}, … ]</code>
<div class="tests">Tests: <a href="tests/callback.html">callback</a> <a href="tests/crosshair.html">crosshair</a> </div>
};
/**
- * 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