From 0cd1ad15aefb3bd6507886e4cbba0d7587a56610 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Tue, 22 Jan 2013 22:09:50 -0500 Subject: [PATCH] nearly all lint errors gone; closure compiler still happy --- dygraph-canvas.js | 8 +------- dygraph-tickers.js | 7 +++---- dygraph-utils.js | 1 - dygraph.js | 7 +++---- plugins/annotations.js | 2 ++ plugins/axes.js | 9 +++++---- plugins/base.js | 2 ++ plugins/chart-labels.js | 2 ++ plugins/grid.js | 1 + plugins/install.js | 2 ++ plugins/legend.js | 3 ++- plugins/range-selector.js | 1 + plugins/unzoom.js | 1 + 13 files changed, 25 insertions(+), 21 deletions(-) diff --git a/dygraph-canvas.js b/dygraph-canvas.js index fad3054..89d28b4 100644 --- a/dygraph-canvas.js +++ b/dygraph-canvas.js @@ -343,7 +343,7 @@ DygraphCanvasRenderer._drawSeries = function(e, isIsolated = false; if (drawGapPoints || !prevCanvasX) { iter.nextIdx_ = i; - var peek = iter.next(); + iter.next(); nextCanvasY = iter.hasNext ? iter.peek.canvasy : null; var isNextCanvasYNullOrNaN = nextCanvasY === null || @@ -444,13 +444,10 @@ DygraphCanvasRenderer.prototype._updatePoints = function() { */ DygraphCanvasRenderer.prototype._renderLineChart = function(opt_seriesName, opt_ctx) { var ctx = opt_ctx || this.elementContext; - var errorBars = this.attr_("errorBars") || this.attr_("customBars"); - var fillGraph = this.attr_("fillGraph"); var i; var sets = this.layout.points; var setNames = this.layout.setNames; - var setCount = setNames.length; var setName; this.colors = this.dygraph_.colorsMap_; @@ -595,7 +592,6 @@ DygraphCanvasRenderer._errorPlotter = function(e) { var color = e.color; var fillAlpha = g.getOption('fillAlpha', setName); var stepPlot = g.getOption('stepPlot'); // TODO(danvk): per-series - var axis = e.axis; var points = e.points; var iter = Dygraph.createIterator(points, 0, points.length, @@ -608,7 +604,6 @@ DygraphCanvasRenderer._errorPlotter = function(e) { var prevX = NaN; var prevY = NaN; var prevYs = [-1, -1]; - var yscale = axis.yscale; // should be same color as the lines but only 15% opaque. var rgb = new RGBColorParser(color); var err_color = @@ -724,7 +719,6 @@ DygraphCanvasRenderer._fillPlotter = function(e) { var prevX = NaN; var prevYs = [-1, -1]; var newYs; - var yscale = axis.yscale; // should be same color as the lines but only 15% opaque. var rgb = new RGBColorParser(color); var err_color = diff --git a/dygraph-tickers.js b/dygraph-tickers.js index 918d442..6ad3102 100644 --- a/dygraph-tickers.js +++ b/dygraph-tickers.js @@ -63,7 +63,7 @@ "use strict"; /** @typedef {Array.<{v:number, label:string, label_v:(string|undefined)}>} */ -Dygraph.TickList; +Dygraph.TickList = undefined; // the ' = undefined' keeps jshint happy. /** @typedef {function( * number, @@ -74,8 +74,7 @@ Dygraph.TickList; * Array.= * ): Dygraph.TickList} */ -Dygraph.Ticker; - +Dygraph.Ticker = undefined; // the ' = undefined' keeps jshint happy. /** @type {Dygraph.Ticker} */ Dygraph.numericLinearTicks = function(a, b, pixels, opts, dygraph, vals) { @@ -182,7 +181,7 @@ Dygraph.numericTicks = function(a, b, pixels, opts, dygraph, vals) { // that results in tick marks spaced sufficiently far apart. // The "mults" array should cover the range 1 .. base^2 to // adjust for rounding and edge effects. - var scale, low_val, high_val, nTicks, spacing; + var scale, low_val, high_val, spacing; for (j = 0; j < mults.length; j++) { scale = base_scale * mults[j]; low_val = Math.floor(a / scale) * scale; diff --git a/dygraph-utils.js b/dygraph-utils.js index 9f836e2..1d1623f 100644 --- a/dygraph-utils.js +++ b/dygraph-utils.js @@ -1029,7 +1029,6 @@ Dygraph.regularShape_ = function( delta = delta || Math.PI * 2 / sides; ctx.beginPath(); - var first = true; var initialAngle = rotationRadians; var angle = initialAngle; diff --git a/dygraph.js b/dygraph.js index bcfd52f..ecbbca7 100644 --- a/dygraph.js +++ b/dygraph.js @@ -1685,7 +1685,6 @@ Dygraph.prototype.findStackedPoint = function(domX, domY) { var row = this.findClosestRow(domX); var boundary = this.getLeftBoundary_(); var rowIdx = row - boundary; - var sets = this.layout_.points; var closestPoint, closestSeries; for (var setIdx = 0; setIdx < this.layout_.datasets.length; ++setIdx) { var points = this.layout_.points[setIdx]; @@ -1836,7 +1835,8 @@ Dygraph.prototype.animateSelection_ = function(direction) { * @private */ Dygraph.prototype.updateSelection_ = function(opt_animFraction) { - var defaultPrevented = this.cascadeEvents_('select', { + /*var defaultPrevented = */ + this.cascadeEvents_('select', { selectedX: this.lastx_, selectedPoints: this.selPoints_ }); @@ -2410,10 +2410,9 @@ Dygraph.prototype.renderGraph_ = function(is_initial_draw) { * indices are into the axes_ array. */ Dygraph.prototype.computeYAxes_ = function() { - // Preserve valueWindow settings if they exist, and if the user hasn't // specified a new valueRange. - var i, valueWindows, seriesName, axis, index, opts, v; + var valueWindows, axis, index, opts, v; if (this.axes_ !== undefined && this.user_attrs_.hasOwnProperty("valueRange") === false) { valueWindows = []; for (index = 0; index < this.axes_.length; index++) { diff --git a/plugins/annotations.js b/plugins/annotations.js index 94a0642..6a24894 100644 --- a/plugins/annotations.js +++ b/plugins/annotations.js @@ -4,6 +4,8 @@ * MIT-licensed (http://opensource.org/licenses/MIT) */ +/*global Dygraph:false */ + Dygraph.Plugins.Annotations = (function() { "use strict"; diff --git a/plugins/axes.js b/plugins/axes.js index 15bb8f5..1e17ff2 100644 --- a/plugins/axes.js +++ b/plugins/axes.js @@ -4,6 +4,8 @@ * MIT-licensed (http://opensource.org/licenses/MIT) */ +/*global Dygraph:false */ + Dygraph.Plugins.Axes = (function() { "use strict"; @@ -52,7 +54,7 @@ axes.prototype.layout = function(e) { if (g.getOption('drawYAxis')) { var w = g.getOption('yAxisLabelWidth') + 2 * g.getOption('axisTickSize'); - var y_axis_rect = e.reserveSpaceLeft(w); + e.reserveSpaceLeft(w); } if (g.getOption('drawXAxis')) { @@ -65,13 +67,13 @@ axes.prototype.layout = function(e) { } else { h = g.getOptionForAxis('axisLabelFontSize', 'x') + 2 * g.getOption('axisTickSize'); } - var x_axis_rect = e.reserveSpaceBottom(h); + e.reserveSpaceBottom(h); } if (g.numAxes() == 2) { // TODO(danvk): per-axis setting. var w = g.getOption('yAxisLabelWidth') + 2 * g.getOption('axisTickSize'); - var y2_axis_rect = e.reserveSpaceRight(w); + e.reserveSpaceRight(w); } else if (g.numAxes() > 2) { g.error("Only two y-axes are supported at this time. (Trying " + "to use " + g.numAxes() + ")"); @@ -93,7 +95,6 @@ axes.prototype.detachLabels = function() { }; axes.prototype.clearChart = function(e) { - var g = e.dygraph; this.detachLabels(); }; diff --git a/plugins/base.js b/plugins/base.js index 518a620..f5e6216 100644 --- a/plugins/base.js +++ b/plugins/base.js @@ -1,3 +1,5 @@ +/*global Dygraph:false */ + // Namespace for plugins. Dygraph.Plugins = {}; diff --git a/plugins/chart-labels.js b/plugins/chart-labels.js index 2aaae26..da231d8 100644 --- a/plugins/chart-labels.js +++ b/plugins/chart-labels.js @@ -3,6 +3,8 @@ * Copyright 2012 Dan Vanderkam (danvdk@gmail.com) * MIT-licensed (http://opensource.org/licenses/MIT) */ +/*global Dygraph:false */ + Dygraph.Plugins.ChartLabels = (function() { "use strict"; diff --git a/plugins/grid.js b/plugins/grid.js index 6284abb..9186dd4 100644 --- a/plugins/grid.js +++ b/plugins/grid.js @@ -3,6 +3,7 @@ * Copyright 2012 Dan Vanderkam (danvdk@gmail.com) * MIT-licensed (http://opensource.org/licenses/MIT) */ +/*global Dygraph:false */ Dygraph.Plugins.Grid = (function() { diff --git a/plugins/install.js b/plugins/install.js index ecf7b3b..656d426 100644 --- a/plugins/install.js +++ b/plugins/install.js @@ -1,3 +1,5 @@ +/*global Dygraph:false */ + // This file defines the ordering of the plugins. // // The ordering is from most-general to most-specific. diff --git a/plugins/legend.js b/plugins/legend.js index 79f758d..35f30b0 100644 --- a/plugins/legend.js +++ b/plugins/legend.js @@ -3,6 +3,7 @@ * Copyright 2012 Dan Vanderkam (danvdk@gmail.com) * MIT-licensed (http://opensource.org/licenses/MIT) */ +/*global Dygraph:false */ Dygraph.Plugins.Legend = (function() { /* @@ -189,7 +190,7 @@ generateLegendHTML = function(g, x, sel_points, oneEmWidth) { // If no points are selected, we display a default legend. Traditionally, // this has been blank. But a better default would be a conventional legend, // which provides essential information for a non-interactive chart. - var html, sepLines, i, c, dash, strokePattern; + var html, sepLines, i, dash, strokePattern; var labels = g.getLabels(); if (typeof(x) === 'undefined') { diff --git a/plugins/range-selector.js b/plugins/range-selector.js index 2c32fa5..797140c 100644 --- a/plugins/range-selector.js +++ b/plugins/range-selector.js @@ -3,6 +3,7 @@ * Copyright 2011 Paul Felix (paul.eric.felix@gmail.com) * MIT-licensed (http://opensource.org/licenses/MIT) */ +/*global Dygraph:false,TouchEvent:false */ /** * @fileoverview This file contains the RangeSelector plugin used to provide diff --git a/plugins/unzoom.js b/plugins/unzoom.js index 726a1f6..802c31b 100644 --- a/plugins/unzoom.js +++ b/plugins/unzoom.js @@ -18,6 +18,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +/*global Dygraph:false */ /** * @fileoverview Plug-in for providing unzoom-on-hover. -- 2.7.4