X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph-gviz.js;h=b87fe80f7596f0ecb8beae16867fea31c5f04e9d;hb=b49775481c37d9c849d91c25221e84349477361f;hp=110ded24e1bc2f503a20ec09fdce0b6f694beefe;hpb=74a5af31a87b245b89337037bc33a0e900153eae;p=dygraphs.git diff --git a/dygraph-gviz.js b/dygraph-gviz.js index 110ded2..b87fe80 100644 --- a/dygraph-gviz.js +++ b/dygraph-gviz.js @@ -1,5 +1,8 @@ -// Copyright 2011 Dan Vanderkam (danvdk@gmail.com) -// All Rights Reserved. +/** + * @license + * Copyright 2011 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ /** * @fileoverview A wrapper around the Dygraph class which implements the @@ -14,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. @@ -32,7 +39,7 @@ Dygraph.GVizChart.prototype.draw = function(data, options) { } this.date_graph = new Dygraph(this.container, data, options); -} +}; /** * Google charts compatible setSelection @@ -46,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 @@ -60,12 +67,14 @@ Dygraph.GVizChart.prototype.getSelection = function() { if (row < 0) return selection; - col = 1; - for (var i in this.date_graph.layout_.datasets) { + 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++; } return selection; -} +};