* MIT-licensed (http://opensource.org/licenses/MIT)
*/
+"use strict";
+
+var OPTIONS_REFERENCE = null;
+
+// For "production" code, this gets removed by uglifyjs.
+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()*",
// 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;