X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph-gviz.js;h=49feac5e462079727e222d834a4351fc7f7ace5d;hb=2323945cebe74e7ca1f3897fcb5e7a5aed5fc80f;hp=b87fe80f7596f0ecb8beae16867fea31c5f04e9d;hpb=795b16307db2a673ba7aa3452f6f6b0e93baeb3a;p=dygraphs.git diff --git a/dygraph-gviz.js b/dygraph-gviz.js index b87fe80..49feac5 100644 --- a/dygraph-gviz.js +++ b/dygraph-gviz.js @@ -23,12 +23,18 @@ /** * A wrapper around Dygraph that implements the gviz API. - * @param {Object} container The DOM object the visualization should live in. + * @param {!HTMLDivElement} container The DOM object the visualization should + * live in. + * @constructor */ Dygraph.GVizChart = function(container) { this.container = container; }; +/** + * @param {GVizDataTable} data + * @param {Object.<*>} options + */ Dygraph.GVizChart.prototype.draw = function(data, options) { // Clear out any existing dygraph. // TODO(danvk): would it make more sense to simply redraw using the current @@ -44,7 +50,7 @@ Dygraph.GVizChart.prototype.draw = function(data, options) { /** * Google charts compatible setSelection * Only row selection is supported, all points in the row will be highlighted - * @param {Array} array of the selected cells + * @param {Array.<{row:number}>} selection_array array of the selected cells * @public */ Dygraph.GVizChart.prototype.setSelection = function(selection_array) { @@ -57,7 +63,7 @@ Dygraph.GVizChart.prototype.setSelection = function(selection_array) { /** * Google charts compatible getSelection implementation - * @return {Array} array of the selected cells + * @return {Array.<{row:number,column:number}>} array of the selected cells * @public */ Dygraph.GVizChart.prototype.getSelection = function() { @@ -67,14 +73,10 @@ Dygraph.GVizChart.prototype.getSelection = function() { if (row < 0) return selection; - var col = 1; var datasets = this.date_graph.layout_.datasets; - for (var k in datasets) { - if (!datasets.hasOwnProperty(k)) continue; - selection.push({row: row, column: col}); - col++; + for (var setIdx = 0; setIdx < datasets.length; ++setIdx) { + selection.push({row: row, column: setIdx + 1}); } return selection; }; -