From e88a95b4dbb4cb6f8d8cb4086209915944cbea54 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Sat, 14 Dec 2013 13:52:33 -0500 Subject: [PATCH] fix additional lint errors --- gallery/annotations-gviz.js | 4 +++- gallery/annotations-native.js | 3 ++- gallery/annotations.js | 6 +++--- gallery/avoid-min-zero.js | 9 +++++---- gallery/border.js | 3 ++- gallery/callbacks.js | 6 ++++-- gallery/color-cycle.js | 3 ++- gallery/color-visibility.js | 9 ++++++--- gallery/demo.js | 3 ++- gallery/drawing.js | 6 ++++-- gallery/dygraph-simple.js | 5 +++-- gallery/dynamic-update.js | 1 + gallery/edge-padding.js | 1 + gallery/gallery-template.js | 3 ++- gallery/gallery.js | 1 + gallery/highlighted-region.js | 3 ++- gallery/highlighted-series.js | 1 + gallery/highlighted-weekends.js | 4 ++-- gallery/independent-series.js | 5 +++-- gallery/interaction-api.js | 1 + gallery/interaction.js | 11 +++++++---- gallery/linear-regression.js | 10 ++++++---- gallery/link-interaction.js | 9 +++++---- gallery/negative.js | 7 ++++--- gallery/no-range.js | 5 +++-- gallery/number-format.js | 11 ++++++----- gallery/per-series.js | 3 ++- gallery/plotter.js | 7 +++++-- gallery/range-selector.js | 6 ++++-- gallery/resize.js | 4 +++- gallery/stock.js | 6 ++++-- gallery/styled-chart-labels.js | 5 +++-- gallery/synchronize.js | 4 +++- gallery/temperature-sf-ny.js | 8 +++++--- gallery/two-axes.js | 2 ++ 35 files changed, 112 insertions(+), 63 deletions(-) diff --git a/gallery/annotations-gviz.js b/gallery/annotations-gviz.js index a9ce26c..ceea4f1 100644 --- a/gallery/annotations-gviz.js +++ b/gallery/annotations-gviz.js @@ -1,3 +1,5 @@ +/*global Gallery,Dygraph,data */ +/*global google */ Gallery.register( 'annotations-gviz', { @@ -11,7 +13,7 @@ Gallery.register( "
"; }, run: function() { - drawChart = function() { + var drawChart = function() { var data = new google.visualization.DataTable(); data.addColumn('date', 'Date'); data.addColumn('number', 'Sold Pencils'); diff --git a/gallery/annotations-native.js b/gallery/annotations-native.js index 8ed7ff9..0183b02 100644 --- a/gallery/annotations-native.js +++ b/gallery/annotations-native.js @@ -1,3 +1,4 @@ +/*global Gallery,Dygraph,data */ Gallery.register( 'annotations-native', { @@ -9,7 +10,7 @@ Gallery.register( "
"; }, run: function() { - g = new Dygraph( + var g = new Dygraph( document.getElementById("demodiv"), [ [ new Date("2011/11/01"), 100 ], diff --git a/gallery/annotations.js b/gallery/annotations.js index af0c542..290f0db 100644 --- a/gallery/annotations.js +++ b/gallery/annotations.js @@ -1,3 +1,4 @@ +/*global Gallery,Dygraph,data */ Gallery.register( 'annotations', { @@ -19,7 +20,7 @@ Gallery.register( return "(" + ann.series + ", " + ann.x + ")"; } - g = new Dygraph( + var g = new Dygraph( document.getElementById("g_div"), function() { var zp = function(x) { if (x < 10) return "0"+x; else return x; }; @@ -54,7 +55,7 @@ Gallery.register( ); var last_ann = 0; - annotations = []; + var annotations = []; for (var x = 10; x < 15; x += 2) { annotations.push( { series: 'sine wave', @@ -81,7 +82,6 @@ Gallery.register( document.getElementById('add').onclick = function() { var x = last_ann + 2; - var annnotations = g.annotations(); annotations.push( { series: 'line', x: "200610" + x, diff --git a/gallery/avoid-min-zero.js b/gallery/avoid-min-zero.js index 96a3cbc..e74345f 100644 --- a/gallery/avoid-min-zero.js +++ b/gallery/avoid-min-zero.js @@ -1,3 +1,4 @@ +/*global Gallery,Dygraph,data */ Gallery.register( 'avoid-min-zero', { @@ -10,7 +11,7 @@ Gallery.register( "

4: Step chart with avoidMinZero option:

"; }, run: function() { - var g1 = new Dygraph(document.getElementById("graph1"), + new Dygraph(document.getElementById("graph1"), "Date,Temperature\n" + "2008-05-07,0\n" + "2008-05-08,1\n" + @@ -19,7 +20,7 @@ Gallery.register( "2008-05-11,3\n" + "2008-05-12,4\n" ); - var g2 = new Dygraph(document.getElementById("graphd2"), + new Dygraph(document.getElementById("graphd2"), "Date,Temperature\n" + "2008-05-07,0\n" + "2008-05-08,1\n" + @@ -31,7 +32,7 @@ Gallery.register( stepPlot: true } ); - var g3 = new Dygraph(document.getElementById("graph3"), + new Dygraph(document.getElementById("graph3"), "Date,Temperature\n" + "2008-05-07,0\n" + "2008-05-08,1\n" + @@ -43,7 +44,7 @@ Gallery.register( avoidMinZero: true } ); - var g4 = new Dygraph(document.getElementById("graphd4"), + new Dygraph(document.getElementById("graphd4"), "Date,Temperature\n" + "2008-05-07,0\n" + "2008-05-08,1\n" + diff --git a/gallery/border.js b/gallery/border.js index 38adf5c..b5e4f68 100644 --- a/gallery/border.js +++ b/gallery/border.js @@ -1,3 +1,4 @@ +/*global Gallery,Dygraph,data */ Gallery.register( 'border', { @@ -8,7 +9,7 @@ Gallery.register( "
"; }, run: function() { - var g = new Dygraph(document.getElementById('bordered'), data, + new Dygraph(document.getElementById('bordered'), data, { labelsDivStyles: { border: '1px solid black' }, title: 'Chart Title', diff --git a/gallery/callbacks.js b/gallery/callbacks.js index dfa4a97..fa1bb07 100644 --- a/gallery/callbacks.js +++ b/gallery/callbacks.js @@ -1,3 +1,5 @@ +/*global Gallery,Dygraph,data */ +/*global NoisyData */ Gallery.register( 'callbacks', { @@ -14,6 +16,7 @@ Gallery.register( "
"; }, run: function() { + var g = null; var showLabels = document.getElementById('showLabels'); showLabels.onclick = function() { g.updateOptions({showLabelsOnHighlight: showLabels.checked}); @@ -25,8 +28,7 @@ Gallery.register( }; document.getElementById('clear').onclick = clearStatus; - var g = null; - pts_info = function(e, x, pts, row) { + var pts_info = function(e, x, pts, row) { var str = "(" + x + ") "; for (var i = 0; i < pts.length; i++) { var p = pts[i]; diff --git a/gallery/color-cycle.js b/gallery/color-cycle.js index a625d7c..b1c0993 100644 --- a/gallery/color-cycle.js +++ b/gallery/color-cycle.js @@ -1,3 +1,4 @@ +/*global Gallery,Dygraph,data */ Gallery.register( 'color-cycle', { @@ -18,7 +19,7 @@ Gallery.register( ['#444444', '#888888', '#DDDDDD'], null ]; - chart = new Dygraph(document.getElementById("blah"), + var chart = new Dygraph(document.getElementById("blah"), "X,a,b,c\n" + "10,12345,23456,34567\n" + "11,12345,20123,31345\n", diff --git a/gallery/color-visibility.js b/gallery/color-visibility.js index cf3e0e3..5e5cc96 100644 --- a/gallery/color-visibility.js +++ b/gallery/color-visibility.js @@ -1,3 +1,5 @@ +/*global Gallery,Dygraph,data,$ */ +/*jshint unused:false */ Gallery.register( 'color-visibility', { @@ -27,8 +29,9 @@ Gallery.register( visibility: [true, true, true] }); - function change(el) { - g.setVisibility(el.id, el.checked); - } + $('input[type=checkbox]').click(function() { + var el = this; + g.setVisibility(el.id, el.checked); + }); } }); diff --git a/gallery/demo.js b/gallery/demo.js index 8be2332..9b80246 100644 --- a/gallery/demo.js +++ b/gallery/demo.js @@ -1,3 +1,4 @@ +/*global Gallery,Dygraph,data */ Gallery.register( 'demo', { @@ -14,7 +15,7 @@ Gallery.register( ""; }, run: function() { - var g = new Dygraph( + new Dygraph( document.getElementById("demodiv"), function() { var zp = function(x) { if (x < 10) return "0"+x; else return x; }; diff --git a/gallery/drawing.js b/gallery/drawing.js index 4452967..c664650 100644 --- a/gallery/drawing.js +++ b/gallery/drawing.js @@ -1,3 +1,4 @@ +/*global Gallery,Dygraph,data */ Gallery.register( 'drawing', { @@ -16,6 +17,7 @@ Gallery.register( }, run: function() { + var change_tool; // defined below. var zoom = document.getElementById('tool_zoom'); zoom.onclick = function() { change_tool(zoom); }; var pencil = document.getElementById('tool_pencil'); @@ -89,7 +91,7 @@ Gallery.register( lastDrawValue = null; } - var change_tool = function(tool_div) { + change_tool = function(tool_div) { var ids = ['tool_zoom', 'tool_pencil', 'tool_eraser']; for (var i = 0; i < ids.length; i++) { var div = document.getElementById(ids[i]); @@ -112,7 +114,7 @@ Gallery.register( }; change_tool(document.getElementById("tool_pencil")); - g = new Dygraph(document.getElementById("draw_div"), data, + new Dygraph(document.getElementById("draw_div"), data, { valueRange: valueRange, labels: [ 'Date', 'Value' ], diff --git a/gallery/dygraph-simple.js b/gallery/dygraph-simple.js index dd6faa1..658c2c3 100644 --- a/gallery/dygraph-simple.js +++ b/gallery/dygraph-simple.js @@ -1,3 +1,4 @@ +/*global Gallery,Dygraph,data */ Gallery.register( 'dygraph-simple', { @@ -7,12 +8,12 @@ Gallery.register( "

Same data, specified in a parsed format:

"; }, run: function() { - g = new Dygraph(document.getElementById("graphdiv"), + new Dygraph(document.getElementById("graphdiv"), "Date,Temperature\n" + "2008-05-07,75\n" + "2008-05-08,70\n" + "2008-05-09,80\n"); - g2 = new Dygraph(document.getElementById("graphdiv2"), + new Dygraph(document.getElementById("graphdiv2"), [ [ new Date("2008/05/07"), 75], [ new Date("2008/05/08"), 70], [ new Date("2008/05/09"), 80] diff --git a/gallery/dynamic-update.js b/gallery/dynamic-update.js index 6bb34ee..0936157 100644 --- a/gallery/dynamic-update.js +++ b/gallery/dynamic-update.js @@ -1,3 +1,4 @@ +/*global Gallery,Dygraph,data */ Gallery.register( 'dynamic-update', { diff --git a/gallery/edge-padding.js b/gallery/edge-padding.js index 160f4bf..b60e37c 100644 --- a/gallery/edge-padding.js +++ b/gallery/edge-padding.js @@ -1,3 +1,4 @@ +/*global Gallery,Dygraph,data */ Gallery.register( 'edge-padding', { diff --git a/gallery/gallery-template.js b/gallery/gallery-template.js index efd9f18..f383748 100644 --- a/gallery/gallery-template.js +++ b/gallery/gallery-template.js @@ -1,4 +1,5 @@ // Use this as a template for new Gallery entries. +/*global Gallery,Dygraph,data */ Gallery.register( 'id', { @@ -8,7 +9,7 @@ Gallery.register( parent.innerHTML = "
"; }, run: function() { - g = new Dygraph(document.getElementById("blah"), + new Dygraph(document.getElementById("blah"), "X,Y\n10,12345\n11,12345\n", {}); } }); diff --git a/gallery/gallery.js b/gallery/gallery.js index 002f7ca..f8b4cee 100644 --- a/gallery/gallery.js +++ b/gallery/gallery.js @@ -1,4 +1,5 @@ /*jshint loopfunc:true */ +/*global Dygraph,$,TextArea,jQuery */ var Gallery = {}; Gallery.entries = {}; diff --git a/gallery/highlighted-region.js b/gallery/highlighted-region.js index 3a951f4..78955d6 100644 --- a/gallery/highlighted-region.js +++ b/gallery/highlighted-region.js @@ -1,3 +1,4 @@ +/*global Gallery,Dygraph,data */ Gallery.register( 'highlighted-region', { @@ -23,7 +24,7 @@ Gallery.register( data[i][2] += 5.0; } - var g = new Dygraph( + new Dygraph( document.getElementById("div_g"), data, { diff --git a/gallery/highlighted-series.js b/gallery/highlighted-series.js index b5ac642..5e97bca 100644 --- a/gallery/highlighted-series.js +++ b/gallery/highlighted-series.js @@ -1,3 +1,4 @@ +/*global Gallery,Dygraph,data */ Gallery.register( 'highlighted-series', { diff --git a/gallery/highlighted-weekends.js b/gallery/highlighted-weekends.js index 09e11a1..b308e07 100644 --- a/gallery/highlighted-weekends.js +++ b/gallery/highlighted-weekends.js @@ -1,3 +1,4 @@ +/*global Gallery,Dygraph,data */ Gallery.register( 'highlighted-weekends', { @@ -42,7 +43,7 @@ Gallery.register( "2011-01-30," + Math.random()*100 + "\n" + "2011-01-31," + Math.random()*100 + "\n"; - var g = new Dygraph( + new Dygraph( document.getElementById("div_g"), data, { @@ -64,7 +65,6 @@ Gallery.register( // get day of week var d = new Date(min_data_x); var dow = d.getUTCDay(); - var ds = d.toUTCString(); var w = min_data_x; // starting on Sunday is a special case diff --git a/gallery/independent-series.js b/gallery/independent-series.js index fab7d1d..59da519 100644 --- a/gallery/independent-series.js +++ b/gallery/independent-series.js @@ -1,3 +1,4 @@ +/*global Gallery,Dygraph,data */ Gallery.register( 'independent-series', { @@ -125,7 +126,7 @@ Gallery.register( " [10, 10, null]\n" + "]"; - var g1 = new Dygraph( + new Dygraph( document.getElementById('graph'), [ [1, null, 3], @@ -142,7 +143,7 @@ Gallery.register( } ); - g2 = new Dygraph( + new Dygraph( document.getElementById('graph2'), 'x,A,B \n' + '1,,3 \n' + diff --git a/gallery/interaction-api.js b/gallery/interaction-api.js index 603dece..ebdfce9 100644 --- a/gallery/interaction-api.js +++ b/gallery/interaction-api.js @@ -1,3 +1,4 @@ +/*global Dygraph */ // Code for a variety of interaction models. Used in interaction.html, but split out from // that file so they can be tested in isolation. // diff --git a/gallery/interaction.js b/gallery/interaction.js index 05b0c80..5936189 100644 --- a/gallery/interaction.js +++ b/gallery/interaction.js @@ -1,3 +1,6 @@ +/*global Gallery,Dygraph,data */ +/*global NoisyData,downV3,moveV3,upV3,clickV3,dblClickV3,scrollV3,restorePositioning,downV4,moveV4,upV4,dblClickV4,captureCanvas */ + Gallery.register( 'interaction', { @@ -46,13 +49,13 @@ Gallery.register( }, run: function() { + var lastClickedGraph; // TODO(konigsberg): Add cleanup to remove callbacks. Dygraph.addEvent(document, "mousewheel", function() { lastClickedGraph = null; }); Dygraph.addEvent(document, "click", function() { lastClickedGraph = null; }); - var g = new Dygraph(document.getElementById("div_g"), + new Dygraph(document.getElementById("div_g"), NoisyData, { errorBars : true }); - var s = document.getElementById("g2_console"); - var g2 = new Dygraph(document.getElementById("div_g2"), + new Dygraph(document.getElementById("div_g2"), NoisyData, { errorBars : true, @@ -70,7 +73,7 @@ Gallery.register( document.getElementById("restore3").onclick = function() { restorePositioning(g3); }; - var g4 = new Dygraph(document.getElementById("div_g4"), + new Dygraph(document.getElementById("div_g4"), NoisyData, { errorBars : true, drawPoints : true, diff --git a/gallery/linear-regression.js b/gallery/linear-regression.js index ce5932a..cb6b9d9 100644 --- a/gallery/linear-regression.js +++ b/gallery/linear-regression.js @@ -1,3 +1,4 @@ +/*global Gallery,Dygraph,data */ Gallery.register( 'linear-regression', { @@ -17,6 +18,7 @@ Gallery.register( "
"].join("\n"); }, run: function() { + var g, regression, clearLines; // defined below document.getElementById("ry1").onclick = function() { regression(1); }; document.getElementById("ry2").onclick = function() { regression(2); }; document.getElementById("clear").onclick = function() { clearLines(); }; @@ -32,7 +34,7 @@ Gallery.register( // if coeffs = [ null, [1, 2], null ] then we draw a regression for series 1 // only. The regression line is y = 1 + 2 * x. var coeffs = [ null, null, null ]; - function regression(series) { + regression = function(series) { // Only run the regression over visible points. var range = g.xAxisRange(); @@ -64,12 +66,12 @@ Gallery.register( } g.updateOptions({}); // forces a redraw. - } + }; - function clearLines() { + clearLines = function() { for (var i = 0; i < coeffs.length; i++) coeffs[i] = null; g.updateOptions({}); - } + }; function drawLines(ctx, area, layout) { if (typeof(g) == 'undefined') return; // won't be set on the initial draw. diff --git a/gallery/link-interaction.js b/gallery/link-interaction.js index 5656e09..68177a3 100644 --- a/gallery/link-interaction.js +++ b/gallery/link-interaction.js @@ -1,3 +1,4 @@ +/*global Gallery,Dygraph,data */ Gallery.register( 'link-interaction', { @@ -26,7 +27,7 @@ Gallery.register( ]); } var orig_range = [ r[0][0].valueOf(), r[r.length - 1][0].valueOf() ]; - g = new Dygraph( + var g = new Dygraph( document.getElementById("div_g"), r, { rollPeriod: 7, @@ -38,7 +39,7 @@ Gallery.register( } ); - var desired_range = null; + var desired_range = null, animate; function approach_range() { if (!desired_range) return; // go halfway there @@ -55,9 +56,9 @@ Gallery.register( animate(); } } - function animate() { + animate = function() { setTimeout(approach_range, 50); - } + }; var zoom = function(res) { var w = g.xAxisRange(); diff --git a/gallery/negative.js b/gallery/negative.js index c2b561c..c6eb681 100644 --- a/gallery/negative.js +++ b/gallery/negative.js @@ -1,3 +1,4 @@ +/*global Gallery,Dygraph,data */ Gallery.register( 'negative', { @@ -23,17 +24,17 @@ Gallery.register( pos.push([i, 1000 + 2 * i, 1100 + i]); } - var g1 = new Dygraph( + new Dygraph( document.getElementById("g1"), negs, { labels: [ 'x', 'y1', 'y2' ] } ); - var g2 = new Dygraph( + new Dygraph( document.getElementById("g2"), mixed, { labels: [ 'x', 'y1', 'y2' ] } ); - var g3 = new Dygraph( + new Dygraph( document.getElementById("g3"), pos, { labels: [ 'x', 'y1', 'y2' ] } ); diff --git a/gallery/no-range.js b/gallery/no-range.js index b06b887..02b5a1d 100644 --- a/gallery/no-range.js +++ b/gallery/no-range.js @@ -1,3 +1,4 @@ +/*global Gallery,Dygraph,data */ Gallery.register( 'no-range', { @@ -11,11 +12,11 @@ Gallery.register( "
"; }, run: function() { - var g1 = new Dygraph(document.getElementById("blah"), + new Dygraph(document.getElementById("blah"), "X,Y\n10,12345\n11,12345\n", { width: 640, height: 480 }); - var g2 = new Dygraph(document.getElementById("blah2"), + new Dygraph(document.getElementById("blah2"), "date,10M\n" + "20021229,10000000.000000\n" + "20030105,10000000.000000\n" + diff --git a/gallery/number-format.js b/gallery/number-format.js index 0d55bee..cc3d22f 100644 --- a/gallery/number-format.js +++ b/gallery/number-format.js @@ -1,3 +1,4 @@ +/*global Gallery,Dygraph,data */ Gallery.register( 'number-format', { @@ -22,7 +23,7 @@ Gallery.register( run: function() { // Helper functions for generating an HTML table for holding the test // results. - createRow = function(columnType, columns) { + var createRow = function(columnType, columns) { var row = document.createElement('tr'); for (var i = 0; i < columns.length; i ++) { var th = document.createElement(columnType); @@ -33,15 +34,15 @@ Gallery.register( return row; }; - createHeaderRow = function(columns) { + var createHeaderRow = function(columns) { return createRow('th', columns); }; - createDataRow = function(columns) { + var createDataRow = function(columns) { return createRow('td', columns); }; - createTable = function(headerColumns, dataColumnsList) { + var createTable = function(headerColumns, dataColumnsList) { var table = document.createElement('table'); table.appendChild(createHeaderRow(headerColumns)); for (var i = 0; i < dataColumnsList.length; i++) { @@ -50,7 +51,7 @@ Gallery.register( return table; }; - updateTable = function() { + var updateTable = function() { var headers = ['Dygraph.floatFormat()', 'toPrecision()', 'Dygraph.floatFormat()', 'toPrecision()']; var numbers = []; diff --git a/gallery/per-series.js b/gallery/per-series.js index 4959964..956cfc3 100644 --- a/gallery/per-series.js +++ b/gallery/per-series.js @@ -1,3 +1,4 @@ +/*global Gallery,Dygraph,data */ Gallery.register( 'per-series', { @@ -7,7 +8,7 @@ Gallery.register( parent.innerHTML = "
"; }, run: function() { - g = new Dygraph( + new Dygraph( document.getElementById("demodiv"), function() { var zp = function(x) { if (x < 10) return "0"+x; else return x; }; diff --git a/gallery/plotter.js b/gallery/plotter.js index d0d14cc..08bdf0f 100644 --- a/gallery/plotter.js +++ b/gallery/plotter.js @@ -1,4 +1,6 @@ +/*global Gallery,Dygraph,data */ /*jshint evil:true */ +/*global fn */ Gallery.register( 'plotter', { @@ -27,6 +29,7 @@ Gallery.register( }, run: function() { + var plot; // defined below var select = document.getElementById("presets"); var presets = { 'id': [ -10, 10, 'function(x) {\n return x;\n}' ], @@ -46,7 +49,7 @@ Gallery.register( }; var plotButton = document.getElementById("plot"); - var plot = function() { + plot = function() { var eq = document.getElementById("eq").value; eval("fn = " + eq); @@ -71,7 +74,7 @@ Gallery.register( data.push(row); } - g = new Dygraph(graph, data); + new Dygraph(graph, data); }; plotButton.onclick = plot; plot(); diff --git a/gallery/range-selector.js b/gallery/range-selector.js index 0ea9efa..3b13ebb 100644 --- a/gallery/range-selector.js +++ b/gallery/range-selector.js @@ -1,3 +1,5 @@ +/*global Gallery,Dygraph,data */ +/*global data_temp */ Gallery.register( 'range-selector', { @@ -12,7 +14,7 @@ Gallery.register( "
"].join("\n"); }, run: function() { - g1 = new Dygraph( + new Dygraph( document.getElementById("noroll"), data_temp, { @@ -24,7 +26,7 @@ Gallery.register( showRangeSelector: true } ); - g2 = new Dygraph( + new Dygraph( document.getElementById("roll14"), data_temp, { diff --git a/gallery/resize.js b/gallery/resize.js index c11d529..3ebc379 100644 --- a/gallery/resize.js +++ b/gallery/resize.js @@ -1,3 +1,5 @@ +/*global Gallery,Dygraph,data */ +/*global NoisyData */ Gallery.register( 'resize', { @@ -7,7 +9,7 @@ Gallery.register( parent.innerHTML = "
"; }, run: function() { - g = new Dygraph( + new Dygraph( document.getElementById("div_g"), NoisyData, { rollPeriod: 7, diff --git a/gallery/stock.js b/gallery/stock.js index 511aef1..ad7319e 100644 --- a/gallery/stock.js +++ b/gallery/stock.js @@ -1,3 +1,5 @@ +/*global Gallery,Dygraph,data */ +/*global stockData */ Gallery.register( 'stock', { @@ -20,12 +22,12 @@ Gallery.register( var linear = document.getElementById("linear"); var log = document.getElementById("log"); - linear.onclick = function() { setLog(false); }; - log.onclick = function() { setLog(true); }; var setLog = function(val) { g.updateOptions({ logscale: val }); linear.disabled = !val; log.disabled = val; }; + linear.onclick = function() { setLog(false); }; + log.onclick = function() { setLog(true); }; } }); diff --git a/gallery/styled-chart-labels.js b/gallery/styled-chart-labels.js index 1248855..0268f6d 100644 --- a/gallery/styled-chart-labels.js +++ b/gallery/styled-chart-labels.js @@ -1,3 +1,4 @@ +/*global Gallery,Dygraph,data */ Gallery.register( 'styled-chart-labels', { @@ -11,7 +12,7 @@ Gallery.register( "
"].join("\n"); }, run: function() { - g = new Dygraph( + new Dygraph( document.getElementById("div_g"), data, { rollPeriod: 7, @@ -28,7 +29,7 @@ Gallery.register( } ); - g2 = new Dygraph( + new Dygraph( document.getElementById("div_g2"), data, { rollPeriod: 30, diff --git a/gallery/synchronize.js b/gallery/synchronize.js index e2b98bb..ae92efb 100644 --- a/gallery/synchronize.js +++ b/gallery/synchronize.js @@ -1,4 +1,6 @@ +/*global Gallery,Dygraph,data */ /*jshint loopfunc:true */ +/*global NoisyData */ Gallery.register( 'synchronize', { @@ -16,7 +18,7 @@ Gallery.register( "
"].join("\n"); }, run: function() { - gs = []; + var gs = []; var blockRedraw = false; for (var i = 1; i <= 4; i++) { gs.push( diff --git a/gallery/temperature-sf-ny.js b/gallery/temperature-sf-ny.js index c8e4fb1..f2c9ad1 100644 --- a/gallery/temperature-sf-ny.js +++ b/gallery/temperature-sf-ny.js @@ -1,3 +1,5 @@ +/*global Gallery,Dygraph,data */ +/*global data_temp */ Gallery.register( // Get a better name. 'temperature-sf-ny', @@ -13,7 +15,7 @@ Gallery.register( .join("\n"); }, run: function() { - g1 = new Dygraph( + new Dygraph( document.getElementById("noroll"), data_temp, { @@ -24,7 +26,7 @@ Gallery.register( labelsDivStyles: { 'textAlign': 'right' } } ); - g2 = new Dygraph( + new Dygraph( document.getElementById("roll14"), data_temp, { @@ -38,4 +40,4 @@ Gallery.register( } ); } - }); \ No newline at end of file + }); diff --git a/gallery/two-axes.js b/gallery/two-axes.js index 80dc5fd..fae6c89 100644 --- a/gallery/two-axes.js +++ b/gallery/two-axes.js @@ -1,3 +1,4 @@ +/*global Gallery,Dygraph,data */ Gallery.register( 'two-axes', { @@ -11,6 +12,7 @@ Gallery.register( ""; }, run: function() { + var g, g2; document.getElementById('check').onchange = function(el) { g.updateOptions( { fillGraph: el.checked } ); g2.updateOptions( { fillGraph: el.checked } ); -- 2.7.4