X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph-gviz.js;h=114263a429b494d5f7fdc0ea4397f14c692ded1c;hb=71f946164029b3033a955252a40e76b77d7ae1a7;hp=5b81d7fca1aa273bcae27096e1e6885e8dc7566c;hpb=88e95c462340958bdfd0ac4c0736b94c5fd21024;p=dygraphs.git diff --git a/dygraph-gviz.js b/dygraph-gviz.js index 5b81d7f..114263a 100644 --- a/dygraph-gviz.js +++ b/dygraph-gviz.js @@ -17,13 +17,17 @@ * - http://dygraphs.com/tests/annotation-gviz.html */ +/*jshint globalstrict: true */ +/*global Dygraph:false */ +"use strict"; + /** * A wrapper around Dygraph that implements the gviz API. * @param {Object} container The DOM object the visualization should live in. */ Dygraph.GVizChart = function(container) { this.container = container; -} +}; Dygraph.GVizChart.prototype.draw = function(data, options) { // Clear out any existing dygraph. @@ -35,7 +39,7 @@ Dygraph.GVizChart.prototype.draw = function(data, options) { } this.date_graph = new Dygraph(this.container, data, options); -} +}; /** * Google charts compatible setSelection @@ -49,7 +53,7 @@ Dygraph.GVizChart.prototype.setSelection = function(selection_array) { row = selection_array[0].row; } this.date_graph.setSelection(row); -} +}; /** * Google charts compatible getSelection implementation @@ -63,12 +67,10 @@ Dygraph.GVizChart.prototype.getSelection = function() { if (row < 0) return selection; - col = 1; - for (var i in this.date_graph.layout_.datasets) { - selection.push({row: row, column: col}); - col++; + var datasets = this.date_graph.layout_.datasets; + for (var setIdx = 0; setIdx < datasets.length; ++setIdx) { + selection.push({row: row, column: setIdx + 1}); } return selection; -} - +};