From 103b7292caaf98d842c99086c413945b1bd7f982 Mon Sep 17 00:00:00 2001 From: Nagy Attila Gabor Date: Wed, 24 Feb 2010 22:22:44 +0100 Subject: [PATCH] Google Visualization API compatible getSelection() method - bugs: returns incorrect data is datasource is unsorted --- dygraph.js | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/dygraph.js b/dygraph.js index 3f8f90e..d20d348 100644 --- a/dygraph.js +++ b/dygraph.js @@ -1028,6 +1028,24 @@ Dygraph.prototype.clearSelection = function() { this.lastx_ = -1; } +/** + * Returns the number of the currently selected row + * @return int row number, of -1 if nothing is selected + * @public + */ +Dygraph.prototype.getSelection = function() { + if (!this.selPoints_ || this.selPoints_.length < 1) { + return -1; + } + + for (var row=0; row