Add JSHint and make dygraphs pass its checks.
[dygraphs.git] / dygraph-options-reference.js
index b29bb47..b5825e6 100644 (file)
@@ -4,6 +4,9 @@
  * MIT-licensed (http://opensource.org/licenses/MIT)
  */
 
+/*jshint globalstrict: true */
+/*global Dygraph:false */
+
 // NOTE: in addition to parsing as JS, this snippet is expected to be valid
 // JSON. This assumption cannot be checked in JS, but it will be checked when
 // documentation is generated by the generate-documentation.py script. For the
@@ -192,17 +195,11 @@ Dygraph.OPTIONS_REFERENCE =  // <JSON>
     "type": "Object",
     "description": "TODO(konigsberg): document this"
   },
-  "xTicker": {
+  "ticker": {
     "default": "Dygraph.dateTicker or Dygraph.numericTicks",
     "labels": ["Axis display"],
     "type": "function(min, max, pixels, opts, dygraph, vals) -> [{v: ..., label: ...}, ...]",
-    "description": "This lets you specify an arbitrary function to generate tick marks on an axis. The tick marks are an array of (value, label) pairs. The built-in functions go to great lengths to choose good tick marks so, if you set this option, you'll most likely want to call one of them and modify the result. See dygraph-tickers.js for an extensive discussion."
-  },
-  "xTicker": {
-    "default": "",
-    "labels": ["Deprecated"],
-    "type": "",
-    "description": "Prefer axes: { x: { ticker } }"
+    "description": "This lets you specify an arbitrary function to generate tick marks on an axis. The tick marks are an array of (value, label) pairs. The built-in functions go to great lengths to choose good tick marks so, if you set this option, you'll most likely want to call one of them and modify the result. See dygraph-tickers.js for an extensive discussion. This is set on a <a href='per-axis.html'>per-axis</a> basis."
   },
   "xAxisLabelWidth": {
     "default": "50",
@@ -447,7 +444,6 @@ Dygraph.OPTIONS_REFERENCE =  // <JSON>
     "default": "null",
     "labels": ["Axis display", "Interactive Elements"],
     "type": "float",
-    "default": "null",
     "description": "A value representing the farthest a graph may be panned, in percent of the display. For example, a value of 0.1 means that the graph can only be panned 10% pased the edges of the displayed values. null means no bounds."
   },
   "title": {
@@ -621,6 +617,7 @@ Dygraph.OPTIONS_REFERENCE =  // <JSON>
 
 // Do a quick sanity check on the options reference.
 (function() {
+  "use strict";
   var warn = function(msg) { if (console) console.warn(msg); };
   var flds = ['type', 'default', 'description'];
   var valid_cats = [
@@ -643,24 +640,25 @@ Dygraph.OPTIONS_REFERENCE =  // <JSON>
    'Debugging',
    'Deprecated'
   ];
+  var i;
   var cats = {};
-  for (var i = 0; i < valid_cats.length; i++) cats[valid_cats[i]] = true;
+  for (i = 0; i < valid_cats.length; i++) cats[valid_cats[i]] = true;
 
   for (var k in Dygraph.OPTIONS_REFERENCE) {
     if (!Dygraph.OPTIONS_REFERENCE.hasOwnProperty(k)) continue;
     var op = Dygraph.OPTIONS_REFERENCE[k];
-    for (var i = 0; i < flds.length; i++) {
+    for (i = 0; i < flds.length; i++) {
       if (!op.hasOwnProperty(flds[i])) {
         warn('Option ' + k + ' missing "' + flds[i] + '" property');
       } else if (typeof(op[flds[i]]) != 'string') {
         warn(k + '.' + flds[i] + ' must be of type string');
       }
     }
-    var labels = op['labels'];
+    var labels = op.labels;
     if (typeof(labels) !== 'object') {
       warn('Option "' + k + '" is missing a "labels": [...] option');
     } else {
-      for (var i = 0; i < labels.length; i++) {
+      for (i = 0; i < labels.length; i++) {
         if (!cats.hasOwnProperty(labels[i])) {
           warn('Option "' + k + '" has label "' + labels[i] +
                '", which is invalid.');