Use link href, not link src (#904)
[dygraphs.git] / src / dygraph-options-reference.js
index 933bdab..9cffd5e 100644 (file)
@@ -4,11 +4,19 @@
  * MIT-licensed (http://opensource.org/licenses/MIT)
  */
 
+"use strict";
+
+var OPTIONS_REFERENCE = null;
+
+// For "production" code, this gets removed by uglifyjs.
+if (typeof(process) !== 'undefined') {
+if (process.env.NODE_ENV != 'production') {
+
 // 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
 // most part, this just means that you should always use double quotes.
-Dygraph.OPTIONS_REFERENCE =  // <JSON>
+OPTIONS_REFERENCE =  // <JSON>
 {
   "xValueParser": {
     "default": "parseFloat() or Date.parse()*",
@@ -34,12 +42,6 @@ Dygraph.OPTIONS_REFERENCE =  // <JSON>
     "type": "integer",
     "description": "The size of the dot to draw on each point in pixels (see drawPoints). A dot is always drawn when a point is \"isolated\", i.e. there is a missing point on either side of it. This also controls the size of those dots."
   },
-  "labelsDivStyles": {
-    "default": "null",
-    "labels": ["Legend"],
-    "type": "{}",
-    "description": "Additional styles to apply to the currently-highlighted points div. For example, { 'fontWeight': 'bold' } will make the labels bold. In general, it is better to use CSS to style the .dygraph-legend class than to use this property."
-  },
   "drawPoints": {
     "default": "false",
     "labels": ["Data Line display"],
@@ -157,6 +159,12 @@ Dygraph.OPTIONS_REFERENCE =  // <JSON>
     "type": "float",
     "description": "Fade the background while highlighting series. 1=fully visible background (disable fading), 0=hiddden background (show highlighted series only)."
   },
+  "highlightSeriesBackgroundColor": {
+    "default": "rgb(255, 255, 255)",
+    "labels": ["Interactive Elements"],
+    "type": "string",
+    "description": "Sets the background color used to fade out the series in conjunction with 'highlightSeriesBackgroundAlpha'."
+  },
   "includeZero": {
     "default": "false",
     "labels": ["Axis display"],
@@ -291,6 +299,12 @@ Dygraph.OPTIONS_REFERENCE =  // <JSON>
     "type": "integer",
     "description": "Width, in pixels, of the chart. If the container div has been explicitly sized, this will be ignored."
   },
+  "pixelRatio": {
+    "default": "(devicePixelRatio / context.backingStoreRatio)",
+    "labels": ["Overall display"],
+    "type": "float",
+    "description": "Overrides the pixel ratio scaling factor for the canvas's 2d context. Ordinarily, this is set to the devicePixelRatio / (context.backingStoreRatio || 1), so on mobile devices, where the devicePixelRatio can be somewhere around 3, performance can be improved by overriding this value to something less precise, like 1, at the expense of resolution."
+  },
   "interactionModel": {
     "default": "...",
     "labels": ["Interactive Elements"],
@@ -426,12 +440,6 @@ Dygraph.OPTIONS_REFERENCE =  // <JSON>
     "example": "[10, 110]",
     "description": "Explicitly set the vertical range of the graph to [low, high]. This may be set on a per-axis basis to define each y-axis separately. If either limit is unspecified, it will be calculated automatically (e.g. [null, 30] to automatically calculate just the lower bound)"
   },
-  "labelsDivWidth": {
-    "default": "250",
-    "labels": ["Legend"],
-    "type": "integer",
-    "description": "Width (in pixels) of the div which shows information on the currently-highlighted points."
-  },
   "colorSaturation": {
     "default": "1.0",
     "labels": ["Data Series Colors"],
@@ -450,6 +458,15 @@ Dygraph.OPTIONS_REFERENCE =  // <JSON>
     "type": "string",
     "description": "When to display the legend. By default, it only appears when a user mouses over the chart. Set it to \"always\" to always display a legend of some sort. When set to \"follow\", legend follows highlighted points."
   },
+  "legendFormatter": {
+    "default": "null",
+    "labels": ["Legend"],
+    "type": "function(data): string",
+    "params": [
+      [ "data", "An object containing information about the selection (or lack of a selection). This includes formatted values and series information. See <a href=\"https://github.com/danvk/dygraphs/pull/683\">here</a> for sample values." ]
+    ],
+    "description": "Set this to supply a custom formatter for the legend. See <a href=\"https://github.com/danvk/dygraphs/pull/683\">this comment</a> and the <a href=\"tests/legend-formatter.html\">legendFormatter demo</a> for usage."
+  },
   "labelsShowZeroValues": {
     "default": "true",
     "labels": ["Legend"],
@@ -480,12 +497,6 @@ Dygraph.OPTIONS_REFERENCE =  // <JSON>
     "type": "integer",
     "description": "Number of pixels to leave blank at the right edge of the Dygraph. This makes it easier to highlight the right-most data point."
   },
-  "avoidMinZero": {
-    "default": "false",
-    "labels": ["Deprecated"],
-    "type": "boolean",
-    "description": "Deprecated, please use yRangePad instead. When set, the heuristic that fixes the Y axis at zero for a data set with the minimum Y value of zero is disabled. \nThis is particularly useful for data sets that contain many zero values, especially for step plots which may otherwise have lines not visible running along the bottom axis."
-  },
   "drawAxesAtZero": {
     "default": "false",
     "labels": ["Axis display"],
@@ -581,7 +592,7 @@ Dygraph.OPTIONS_REFERENCE =  // <JSON>
     "default": "null",
     "labels": ["Axis display", "Interactive Elements"],
     "type": "float",
-    "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."
+    "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% passed the edges of the displayed values. null means no bounds."
   },
   "title": {
     "labels": ["Chart labels"],
@@ -625,12 +636,6 @@ Dygraph.OPTIONS_REFERENCE =  // <JSON>
     "default": "18",
     "description": "Width of the div which contains the y-axis label. Since the y-axis label appears rotated 90 degrees, this actually affects the height of its div."
   },
-  "isZoomedIgnoreProgrammaticZoom" : {
-    "default": "false",
-    "labels": ["Zooming"],
-    "type": "boolean",
-    "description" : "When this option is passed to updateOptions() along with either the <code>dateWindow</code> or <code>valueRange</code> options, the zoom flags are not changed to reflect a zoomed state. This is primarily useful for when the display area of a chart is changed programmatically and also where manual zooming is allowed and use is made of the <code>isZoomed</code> method to determine this."
-  },
   "drawGrid": {
     "default": "true for x and y, false for y2",
     "labels": ["Grid"],
@@ -673,12 +678,6 @@ Dygraph.OPTIONS_REFERENCE =  // <JSON>
     "type": "float (0.0 - 1.0)",
     "description" : "Error bars (or custom bars) for each series are drawn in the same color as the series, but with partial transparency. This sets the transparency. A value of 0.0 means that the error bars will not be drawn, whereas a value of 1.0 means that the error bars will be as dark as the line for the series itself. This can be used to produce chart lines whose thickness varies at each point."
   },
-  "axisLabelColor": {
-    "default": "black",
-    "labels": ["Axis display"],
-    "type": "string",
-    "description" : "Color for x- and y-axis labels. This is a CSS color string."
-  },
   "axisLabelWidth": {
     "default": "50 (y-axis), 60 (x-axis)",
     "labels": ["Axis display", "Chart labels"],
@@ -711,7 +710,7 @@ Dygraph.OPTIONS_REFERENCE =  // <JSON>
   },
   "timingName": {
     "default": "null",
-    "labels": [ "Debugging" ],
+    "labels": [ "Debugging", "Deprecated" ],
     "type": "string",
     "description": "Set this option to log timing information. The value of the option will be logged along with the timimg, so that you can distinguish multiple dygraphs on the same page."
   },
@@ -785,7 +784,7 @@ Dygraph.OPTIONS_REFERENCE =  // <JSON>
     "default": "null",
     "labels": ["Range Selector"],
     "type": "boolean",
-    "description": "Mark this series for inclusion in the range selector. The mini plot curve will be an average of all such series. If this is not specified for any series, the default behavior is to average all the series. Setting it for one series will result in that series being charted alone in the range selector."
+    "description": "Mark this series for inclusion in the range selector. The mini plot curve will be an average of all such series. If this is not specified for any series, the default behavior is to average all the visible series. Setting it for one series will result in that series being charted alone in the range selector. Once it's set for a single series, it needs to be set for all series which should be included (regardless of visibility)."
   },
   "animatedZooms": {
     "default": "false",
@@ -831,57 +830,59 @@ Dygraph.OPTIONS_REFERENCE =  // <JSON>
 // most part, this just means that you should always use double quotes.
 
 // Do a quick sanity check on the options reference.
-(function() {
-  "use strict";
-  var warn = function(msg) { if (window.console) window.console.warn(msg); };
-  var flds = ['type', 'default', 'description'];
-  var valid_cats = [
-   'Annotations',
-   'Axis display',
-   'Chart labels',
-   'CSV parsing',
-   'Callbacks',
-   'Data',
-   'Data Line display',
-   'Data Series Colors',
-   'Error Bars',
-   'Grid',
-   'Interactive Elements',
-   'Range Selector',
-   'Legend',
-   'Overall display',
-   'Rolling Averages',
-   'Series',
-   'Value display/formatting',
-   'Zooming',
-   'Debugging',
-   'Configuration',
-   'Deprecated'
-  ];
-  var i;
-  var cats = {};
-  for (i = 0; i < valid_cats.length; i++) cats[valid_cats[i]] = true;
+var warn = function(msg) { if (window.console) window.console.warn(msg); };
+var flds = ['type', 'default', 'description'];
+var valid_cats = [
+ 'Annotations',
+ 'Axis display',
+ 'Chart labels',
+ 'CSV parsing',
+ 'Callbacks',
+ 'Data',
+ 'Data Line display',
+ 'Data Series Colors',
+ 'Error Bars',
+ 'Grid',
+ 'Interactive Elements',
+ 'Range Selector',
+ 'Legend',
+ 'Overall display',
+ 'Rolling Averages',
+ 'Series',
+ 'Value display/formatting',
+ 'Zooming',
+ 'Debugging',
+ 'Configuration',
+ 'Deprecated'
+];
+var i;
+var cats = {};
+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 (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');
-      }
+for (var k in OPTIONS_REFERENCE) {
+  if (!OPTIONS_REFERENCE.hasOwnProperty(k)) continue;
+  var op = OPTIONS_REFERENCE[k];
+  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;
-    if (typeof(labels) !== 'object') {
-      warn('Option "' + k + '" is missing a "labels": [...] option');
-    } else {
-      for (i = 0; i < labels.length; i++) {
-        if (!cats.hasOwnProperty(labels[i])) {
-          warn('Option "' + k + '" has label "' + labels[i] +
-               '", which is invalid.');
-        }
+  }
+  var labels = op.labels;
+  if (typeof(labels) !== 'object') {
+    warn('Option "' + k + '" is missing a "labels": [...] option');
+  } else {
+    for (i = 0; i < labels.length; i++) {
+      if (!cats.hasOwnProperty(labels[i])) {
+        warn('Option "' + k + '" has label "' + labels[i] +
+             '", which is invalid.');
       }
     }
   }
-})();
+}
+
+}
+}
+
+export default OPTIONS_REFERENCE;