      1 /**
      2  * @license
      3  * Copyright 2011 Dan Vanderkam (danvdk@gmail.com)
      4  * MIT-licenced: https://opensource.org/licenses/MIT
      5  */
      6
      7 "use strict";
      8
      9 var OPTIONS_REFERENCE = null;
     10
     11 if (typeof process !== 'undefined' && process.env.NODE_ENV != 'production') {
     12 // For "production" code, this gets removed by uglifyjs.
     13
     14 // NOTE: in addition to parsing as JS, this snippet is expected to be valid
     15 // JSON. This assumption cannot be checked in JS, but it will be checked when
     16 // documentation is generated by the generate-documentation.py script. For the
     17 // most part, this just means that you should always use double quotes.
     18 OPTIONS_REFERENCE =  // <JSON>
     19 {
     20   "animateBackgroundFade": {
     21     "default": "true",
     22     "labels": ["Overall display"],
     23     "type": "boolean",
     24     "description": "Activate an animation effect for a gradual fade."
     25   },
     26   "xValueParser": {
     27     "default": "parseFloat() or Date.parse()*",
     28     "labels": ["CSV parsing"],
     29     "type": "function(str) -> number",
     30     "description": "A function which parses x-values (i.e. the dependent series). Must return a number, even when the values are dates. In this case, millis since epoch are used. This is used primarily for parsing CSV data. *=Dygraphs is slightly more accepting in the dates which it will parse. See code for details."
     31   },
     32   "stackedGraph": {
     33     "default": "false",
     34     "labels": ["Data Line display"],
     35     "type": "boolean",
     36     "description": "If set, stack series on top of one another rather than drawing them independently. The first series specified in the input data will wind up on top of the chart and the last will be on bottom. NaN values are drawn as white areas without a line on top, see stackedGraphNaNFill for details."
     37   },
     38   "stackedGraphNaNFill": {
     39     "default": "all",
     40     "labels": ["Data Line display"],
     41     "type": "string",
     42     "description": "Controls handling of NaN values inside a stacked graph. NaN values are interpolated/extended for stacking purposes, but the actual point value remains NaN in the legend display. Valid option values are \"all\" (interpolate internally, repeat leftmost and rightmost value as needed), \"inside\" (interpolate internally only, use zero outside leftmost and rightmost value), and \"none\" (treat NaN as zero everywhere)."
     43   },
     44   "pointSize": {
     45     "default": "1",
     46     "labels": ["Data Line display"],
     47     "type": "integer",
     48     "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."
     49   },
     50   "drawPoints": {
     51     "default": "false",
     52     "labels": ["Data Line display"],
     53     "type": "boolean",
     54     "description": "Draw a small dot at each point, in addition to a line going through the point. This makes the individual data points easier to see, but can increase visual clutter in the chart. The small dot can be replaced with a custom rendering by supplying a <a href='#drawPointCallback'>drawPointCallback</a>."
     55   },
     56   "drawGapEdgePoints": {
     57     "default": "false",
     58     "labels": ["Data Line display"],
     59     "type": "boolean",
     60     "description": "Draw points at the edges of gaps in the data. This improves visibility of small data segments or other data irregularities."
     61   },
     62   "drawPointCallback": {
     63     "default": "null",
     64     "labels": ["Data Line display"],
     65     "type": "function(g, seriesName, canvasContext, cx, cy, color, pointSize)",
     66     "parameters": [
     67       [ "g" , "the reference graph" ],
     68       [ "seriesName" , "the name of the series" ],
     69       [ "canvasContext" , "the canvas to draw on" ],
     70       [ "cx" , "center x coordinate" ],
     71       [ "cy" , "center y coordinate" ],
     72       [ "color" , "series color" ],
     73       [ "pointSize" , "the radius of the image." ],
     74       [ "idx" , "the row-index of the point in the data."]
     75     ],
     76     "description": "Draw a custom item when drawPoints is enabled. Default is a small dot matching the series color. This method should constrain drawing to within pointSize pixels from (cx, cy).  Also see <a href='#drawHighlightPointCallback'>drawHighlightPointCallback</a>"
     77   },
     78   "height": {
     79     "default": "320",
     80     "labels": ["Overall display"],
     81     "type": "integer",
     82     "description": "Height, in pixels, of the chart. If the container div has been explicitly sized, this will be ignored."
     83   },
     84   "resizable": {
     85     "default": "no",
     86     "labels": ["Overall display"],
     87     "type": "string",
     88     "description": "Whether to add a ResizeObserver to the container div (\"passive\") and additionally make it resizable (\"horizontal\", \"vertical\", \"both\"). In any case, if the container div has CSS \"overflow:visible;\" it will be changed to \"overflow:hidden;\" to make CSS resizing possible. Note that this is distinct from resizing the graph when the window size changes, which is always active; this feature adds user-resizable “handles” to the container div."
     89   },
     90   "zoomCallback": {
     91     "default": "null",
     92     "labels": ["Callbacks"],
     93     "type": "function(minDate, maxDate, yRanges)",
     94     "parameters": [
     95       [ "minDate" , "milliseconds since epoch" ],
     96       [ "maxDate" , "milliseconds since epoch." ],
     97       [ "yRanges" , "is an array of [bottom, top] pairs, one for each y-axis." ]
     98     ],
     99     "description": "A function to call when the zoom window is changed (either by zooming in or out). When animatedZooms is set, zoomCallback is called once at the end of the transition (it will not be called for intermediate frames)."
    100   },
    101   "pointClickCallback": {
    102     "snippet": "function(e, point){<br>  alert(point);<br>}",
    103     "default": "null",
    104     "labels": ["Callbacks", "Interactive Elements"],
    105     "type": "function(e, point)",
    106     "parameters": [
    107       [ "e" , "the event object for the click" ],
    108       [ "point" , "the point that was clicked See <a href='#point_properties'>Point properties</a> for details" ]
    109     ],
    110     "description": "A function to call when a data point is clicked. and the point that was clicked."
    111   },
    112   "color": {
    113     "default": "(see description)",
    114     "labels": ["Data Series Colors"],
    115     "type": "string",
    116     "example": "red",
    117     "description": "A per-series color definition. Used in conjunction with, and overrides, the colors option."
    118   },
    119   "colors": {
    120     "default": "(see description)",
    121     "labels": ["Data Series Colors"],
    122     "type": "Array of strings",
    123     "example": "['red', '#00FF00']",
    124     "description": "List of colors for the data series. These can be of the form \"#AABBCC\" or \"rgb(255,100,200)\" or \"yellow\", etc. If not specified, equally-spaced points around a color wheel are used. Overridden by the “color” option."
    125   },
    126   "connectSeparatedPoints": {
    127     "default": "false",
    128     "labels": ["Data Line display"],
    129     "type": "boolean",
    130     "description": "Usually, when Dygraphs encounters a missing value in a data series, it interprets this as a gap and draws it as such. If, instead, the missing values represents an x-value for which only a different series has data, then you’ll want to connect the dots by setting this to true. To explicitly include a gap with this option set, use a value of NaN."
    131   },
    132   "highlightCallback": {
    133     "default": "null",
    134     "labels": ["Callbacks"],
    135     "type": "function(event, x, points, row, seriesName)",
    136     "description": "When set, this callback gets called every time a new point is highlighted.",
    137     "parameters": [
    138       ["event", "the JavaScript mousemove event"],
    139       ["x", "the x-coordinate of the highlighted points"],
    140       ["points", "an array of highlighted points: <code>[ {name: 'series', yval: y-value}, … ]</code>"],
    141       ["row", "integer index of the highlighted row in the data table, starting from 0"],
    142       ["seriesName", "name of the highlighted series, only present if highlightSeriesOpts is set."]
    143     ]
    144   },
    145   "drawHighlightPointCallback": {
    146     "default": "null",
    147     "labels": ["Data Line display"],
    148     "type": "function(g, seriesName, canvasContext, cx, cy, color, pointSize)",
    149     "parameters": [
    150       [ "g" , "the reference graph" ],
    151       [ "seriesName" , "the name of the series" ],
    152       [ "canvasContext" , "the canvas to draw on" ],
    153       [ "cx" , "center x coordinate" ],
    154       [ "cy" , "center y coordinate" ],
    155       [ "color" , "series color" ],
    156       [ "pointSize" , "the radius of the image." ],
    157       [ "idx" , "the row-index of the point in the data."]
    158     ],
    159     "description": "Draw a custom item when a point is highlighted.  Default is a small dot matching the series color. This method should constrain drawing to within pointSize pixels from (cx, cy) Also see <a href='#drawPointCallback'>drawPointCallback</a>"
    160   },
    161   "highlightSeriesOpts": {
    162     "default": "null",
    163     "labels": ["Interactive Elements"],
    164     "type": "Object",
    165     "description": "When set, the options from this object are applied to the timeseries closest to the mouse pointer for interactive highlighting. See also “highlightCallback”. Example: highlightSeriesOpts: { strokeWidth: 3 }."
    166   },
    167   "highlightSeriesBackgroundAlpha": {
    168     "default": "0.5",
    169     "labels": ["Interactive Elements"],
    170     "type": "float",
    171     "description": "Fade the background while highlighting series. 1=fully visible background (disable fading), 0=hiddden background (show highlighted series only)."
    172   },
    173   "highlightSeriesBackgroundColor": {
    174     "default": "rgb(255, 255, 255)",
    175     "labels": ["Interactive Elements"],
    176     "type": "string",
    177     "description": "Sets the background color used to fade out the series in conjunction with “highlightSeriesBackgroundAlpha”."
    178   },
    179   "includeZero": {
    180     "default": "false",
    181     "labels": ["Axis display"],
    182     "type": "boolean",
    183     "description": "Usually, dygraphs will use the range of the data plus some padding to set the range of the y-axis. If this option is set, the y-axis will always include zero, typically as the lowest value. This can be used to avoid exaggerating the variance in the data"
    184   },
    185   "rollPeriod": {
    186     "default": "1",
    187     "labels": ["Error Bars", "Rolling Averages"],
    188     "type": "integer >= 1",
    189     "description": "Number of days over which to average data. Discussed extensively above."
    190   },
    191   "unhighlightCallback": {
    192     "default": "null",
    193     "labels": ["Callbacks"],
    194     "type": "function(event)",
    195     "parameters": [
    196       [ "event" , "the mouse event" ]
    197     ],
    198     "description": "When set, this callback gets called every time the user stops highlighting any point by mousing out of the graph."
    199   },
    200   "axisTickSize": {
    201     "default": "3.0",
    202     "labels": ["Axis display"],
    203     "type": "number",
    204     "description": "The size of the line to display next to each tick mark on x- or y-axes."
    205   },
    206   "labelsSeparateLines": {
    207     "default": "false",
    208     "labels": ["Legend"],
    209     "type": "boolean",
    210     "description": "Put <code><br/></code> between lines in the label string. Often used in conjunction with <strong>labelsDiv</strong>."
    211   },
    212   "valueFormatter": {
    213     "default": "Depends on the type of your data.",
    214     "labels": ["Legend", "Value display/formatting"],
    215     "type": "function(num or millis, opts, seriesName, dygraph, row, col)",
    216     "description": "Function to provide a custom display format for the values displayed on mouseover. This does not affect the values that appear on tick marks next to the axes. To format those, see axisLabelFormatter. This is usually set on a <a href='per-axis.html'>per-axis</a> basis. .",
    217     "parameters": [
    218       ["num_or_millis", "The value to be formatted. This is always a number. For date axes, it’s millis since epoch. You can call new Date(millis) to get a Date object."],
    219       ["opts", "This is a function you can call to access various options (e.g. opts('labelsKMB')). It returns per-axis values for the option when available."],
    220       ["seriesName", "The name of the series from which the point came, e.g. 'X', 'Y', 'A', etc."],
    221       ["dygraph", "The dygraph object for which the formatting is being done"],
    222       ["row", "The row of the data from which this point comes. g.getValue(row, 0) will return the x-value for this point."],
    223       ["col", "The column of the data from which this point comes. g.getValue(row, col) will return the original y-value for this point. This can be used to get the full confidence interval for the point, or access un-rolled values for the point."]
    224     ]
    225   },
    226   "annotationMouseOverHandler": {
    227     "default": "null",
    228     "labels": ["Annotations"],
    229     "type": "function(annotation, point, dygraph, event)",
    230     "description": "If provided, this function is called whenever the user mouses over an annotation."
    231   },
    232   "annotationMouseOutHandler": {
    233     "default": "null",
    234     "labels": ["Annotations"],
    235     "type": "function(annotation, point, dygraph, event)",
    236     "parameters": [
    237       [ "annotation" , "the annotation left" ],
    238       [ "point" , "the point associated with the annotation" ],
    239       [ "dygraph" , "the reference graph" ],
    240       [ "event" , "the mouse event" ]
    241     ],
    242     "description": "If provided, this function is called whenever the user mouses out of an annotation."
    243   },
    244   "annotationClickHandler": {
    245     "default": "null",
    246     "labels": ["Annotations"],
    247     "type": "function(annotation, point, dygraph, event)",
    248     "parameters": [
    249       [ "annotation" , "the annotation left" ],
    250       [ "point" , "the point associated with the annotation" ],
    251       [ "dygraph" , "the reference graph" ],
    252       [ "event" , "the mouse event" ]
    253     ],
    254     "description": "If provided, this function is called whenever the user clicks on an annotation."
    255   },
    256   "annotationDblClickHandler": {
    257     "default": "null",
    258     "labels": ["Annotations"],
    259     "type": "function(annotation, point, dygraph, event)",
    260     "parameters": [
    261       [ "annotation" , "the annotation left" ],
    262       [ "point" , "the point associated with the annotation" ],
    263       [ "dygraph" , "the reference graph" ],
    264       [ "event" , "the mouse event" ]
    265     ],
    266     "description": "If provided, this function is called whenever the user double-clicks on an annotation."
    267   },
    268   "drawCallback": {
    269     "default": "null",
    270     "labels": ["Callbacks"],
    271     "type": "function(dygraph, is_initial)",
    272     "parameters": [
    273       [ "dygraph" , "The graph being drawn" ],
    274       [ "is_initial" , "True if this is the initial draw, false for subsequent draws." ]
    275     ],
    276     "description": "When set, this callback gets called every time the dygraph is drawn. This includes the initial draw, after zooming and repeatedly while panning."
    277   },
    278   "labelsKMG2": {
    279     "default": "false",
    280     "labels": ["Value display/formatting"],
    281     "type": "boolean",
    282     "description": "Show Ki/Mi/Gi for powers of 1024 on y-axis. If used together with <code>labelsKMB</code> (deprecated), K/M/G are used instead."
    283   },
    284   "delimiter": {
    285     "default": ",",
    286     "labels": ["CSV parsing"],
    287     "type": "string",
    288     "description": "The delimiter to look for when separating fields of a CSV file. Setting this to a tab is not usually necessary, since tab-delimited data is auto-detected."
    289   },
    290   "axisLabelFontSize": {
    291     "default": "14",
    292     "labels": ["Axis display"],
    293     "type": "integer",
    294     "description": "Size of the font (in pixels) to use in the axis labels, both x- and y-axis."
    295   },
    296   "underlayCallback": {
    297     "default": "null",
    298     "labels": ["Callbacks"],
    299     "type": "function(context, area, dygraph)",
    300     "parameters": [
    301       [ "context" , "the canvas drawing context on which to draw" ],
    302       [ "area" , "An object with {x,y,w,h} properties describing the drawing area." ],
    303       [ "dygraph" , "the reference graph" ]
    304     ],
    305     "description": "When set, this callback gets called before the chart is drawn. It details on how to use this."
    306   },
    307   "width": {
    308     "default": "480",
    309     "labels": ["Overall display"],
    310     "type": "integer",
    311     "description": "Width, in pixels, of the chart. If the container div has been explicitly sized, this will be ignored."
    312   },
    313   "pixelRatio": {
    314     "default": "(devicePixelRatio / context.backingStoreRatio)",
    315     "labels": ["Overall display"],
    316     "type": "float",
    317     "description": "Overrides the pixel ratio scaling factor for the canvas’ 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."
    318   },
    319   "interactionModel": {
    320     "default": "...",
    321     "labels": ["Interactive Elements"],
    322     "type": "Object",
    323     "description": "TODO(konigsberg): document this"
    324   },
    325   "ticker": {
    326     "default": "Dygraph.dateTicker or Dygraph.numericTicks",
    327     "labels": ["Axis display"],
    328     "type": "function(min, max, pixels, opts, dygraph, vals) -> [{v: ..., label: ...}, ...]",
    329     "parameters": [
    330       [ "min" , "" ],
    331       [ "max" , "" ],
    332       [ "pixels" , "" ],
    333       [ "opts" , "" ],
    334       [ "dygraph" , "the reference graph" ],
    335       [ "vals" , "" ]
    336     ],
    337     "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."
    338   },
    339   "xAxisHeight": {
    340     "default": "(null)",
    341     "labels": ["Axis display"],
    342     "type": "integer",
    343     "description": "Height, in pixels, of the x-axis. If not set explicitly, this is computed based on axisLabelFontSize and axisTickSize."
    344   },
    345   "showLabelsOnHighlight": {
    346     "default": "true",
    347     "labels": ["Interactive Elements", "Legend"],
    348     "type": "boolean",
    349     "description": "Whether to show the legend upon mouseover."
    350   },
    351   "axis": {
    352     "default": "(none)",
    353     "labels": ["Axis display"],
    354     "type": "string",
    355     "description": "Set to either 'y1' or 'y2' to assign a series to a y-axis (primary or secondary). Must be set per-series."
    356   },
    357   "pixelsPerLabel": {
    358     "default": "70 (x-axis) or 30 (y-axes)",
    359     "labels": ["Axis display", "Grid"],
    360     "type": "integer",
    361     "description": "Number of pixels to require between each x- and y-label. Larger values will yield a sparser axis with fewer ticks. This is set on a <a href='per-axis.html'>per-axis</a> basis."
    362   },
    363   "labelsDiv": {
    364     "default": "null",
    365     "labels": ["Legend"],
    366     "type": "DOM element or string",
    367     "example": "<code style='font-size: small'>document.getElementById('foo')</code> or <code>'foo'</code>",
    368     "description": "Show data labels in an external div, rather than on the graph.  This value can either be a div element or a div id."
    369   },
    370   "fractions": {
    371     "default": "false",
    372     "labels": ["CSV parsing", "Error Bars"],
    373     "type": "boolean",
    374     "description": "When set, attempt to parse each cell in the CSV file as \"a/b\", where a and b are integers. The ratio will be plotted. This allows computation of Wilson confidence intervals (see below)."
    375   },
    376   "logscale": {
    377     "default": "false",
    378     "labels": ["Axis display"],
    379     "type": "boolean",
    380     "description": "When set for the y-axis or x-axis, the graph shows that axis in log scale. Any values less than or equal to zero are not displayed. Showing log scale with ranges that go below zero will result in an unviewable graph.\n\n Not compatible with showZero. connectSeparatedPoints is ignored. This is ignored for date-based x-axes."
    381   },
    382   "strokeWidth": {
    383     "default": "1.0",
    384     "labels": ["Data Line display"],
    385     "type": "float",
    386     "example": "0.5, 2.0",
    387     "description": "The width of the lines connecting data points. This can be used to increase the contrast or some graphs."
    388   },
    389   "strokePattern": {
    390     "default": "null",
    391     "labels": ["Data Line display"],
    392     "type": "Array of integers",
    393     "example": "[10, 2, 5, 2]",
    394     "description": "A custom pattern array where the even index is a draw and odd is a space in pixels. If null then it draws a solid line. The array should have a even length as any odd lengthed array could be expressed as a smaller even length array. This is used to create dashed lines."
    395   },
    396   "strokeBorderWidth": {
    397     "default": "null",
    398     "labels": ["Data Line display"],
    399     "type": "float",
    400     "example": "1.0",
    401     "description": "Draw a border around graph lines to make crossing lines more easily distinguishable. Useful for graphs with many lines."
    402   },
    403   "strokeBorderColor": {
    404     "default": "white",
    405     "labels": ["Data Line display"],
    406     "type": "string",
    407     "example": "red, #ccffdd",
    408     "description": "Color for the line border used if strokeBorderWidth is set."
    409   },
    410   "wilsonInterval": {
    411     "default": "true",
    412     "labels": ["Error Bars"],
    413     "type": "boolean",
    414     "description": "Use in conjunction with the \"fractions\" option. Instead of plotting +/- N standard deviations, dygraphs will compute a Wilson confidence interval and plot that. This has more reasonable behavior for ratios close to 0 or 1."
    415   },
    416   "fillGraph": {
    417     "default": "false",
    418     "labels": ["Data Line display"],
    419     "type": "boolean",
    420     "description": "Should the area underneath the graph be filled? This option is not compatible with error bars. This may be set on a <a href='per-axis.html'>per-series</a> basis."
    421   },
    422   "highlightCircleSize": {
    423     "default": "3",
    424     "labels": ["Interactive Elements"],
    425     "type": "integer",
    426     "description": "The size in pixels of the dot drawn over highlighted points."
    427   },
    428   "gridLineColor": {
    429     "default": "rgb(128,128,128)",
    430     "labels": ["Grid"],
    431     "type": "red, blue",
    432     "description": "The color of the gridlines. This may be set on a per-axis basis to define each axis’ grid separately."
    433   },
    434   "gridLinePattern": {
    435     "default": "null",
    436     "labels": ["Grid"],
    437     "type": "Array of integers",
    438     "example": "[10, 2, 5, 2]",
    439     "description": "A custom pattern array where the even index is a draw and odd is a space in pixels. If null then it draws a solid line. The array should have a even length as any odd lengthed array could be expressed as a smaller even length array. This is used to create dashed gridlines."
    440   },
    441   "visibility": {
    442     "default": "[true, true, ...]",
    443     "labels": ["Data Line display"],
    444     "type": "Array of booleans",
    445     "description": "Which series should initially be visible? Once the Dygraph has been constructed, you can access and modify the visibility of each series using the <code>visibility</code> and <code>setVisibility</code> methods."
    446   },
    447   "valueRange": {
    448     "default": "Full range of the input is shown",
    449     "labels": ["Axis display"],
    450     "type": "Array of two numbers",
    451     "example": "[10, 110]",
    452     "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)"
    453   },
    454   "colorSaturation": {
    455     "default": "1.0",
    456     "labels": ["Data Series Colors"],
    457     "type": "float (0.0 - 1.0)",
    458     "description": "If <strong>colors</strong> is not specified, saturation of the automatically-generated data series colors."
    459   },
    460   "hideOverlayOnMouseOut": {
    461     "default": "true",
    462     "labels": ["Interactive Elements", "Legend"],
    463     "type": "boolean",
    464     "description": "Whether to hide the legend when the mouse leaves the chart area."
    465   },
    466   "legend": {
    467     "default": "onmouseover",
    468     "labels": ["Legend"],
    469     "type": "string",
    470     "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, \"never\" to hide it. When set to \"follow\", legend follows highlighted points."
    471   },
    472   "legendFollowOffsetX": {
    473     "default": "50",
    474     "labels": ["Legend"],
    475     "type": "integer",
    476     "description": "Number of pixels to use as horizontal offset from the point for a “floating” legend (\"follow\" mode). This should be positive (to the right) because the legend flips over to the left side if it’s too wide."
    477   },
    478   "legendFollowOffsetY": {
    479     "default": "-50",
    480     "labels": ["Legend"],
    481     "type": "integer",
    482     "description": "Number of pixels to use as vertical offset from the point for a “floating” legend (\"follow\" mode)."
    483   },
    484   "legendFormatter": {
    485     "default": "null",
    486     "labels": ["Legend"],
    487     "type": "function(data): string or DocumentFragment node",
    488     "params": [
    489       [ "data", "An object containing information about the selection (or lack of a selection). This includes formatted values and series information. See <a href=\"legend-formatter.md\"><tt>docs/legend-formatter.md</tt></a> (<a href=\"https://github.com/danvk/dygraphs/blob/master/docs/legend-formatter.md\">online</a>) for sample values." ]
    490     ],
    491     "description": "Set this to supply a custom formatter for the legend. See <a href=\"legend-formatter.md\"><tt>docs/legend-formatter.md</tt></a> (<a href=\"https://github.com/danvk/dygraphs/blob/master/docs/legend-formatter.md\">online</a>) and the <a href=\"tests/legend-formatter.html\">legendFormatter demo</a> for usage."
    492   },
    493   "labelsShowZeroValues": {
    494     "default": "true",
    495     "labels": ["Legend"],
    496     "type": "boolean",
    497     "description": "Show zero value labels in the labelsDiv."
    498   },
    499   "stepPlot": {
    500     "default": "false",
    501     "labels": ["Data Line display"],
    502     "type": "boolean",
    503     "description": "When set, display the graph as a step plot instead of a line plot. This option may either be set for the whole graph or for single series."
    504   },
    505   "labelsUTC": {
    506     "default": "false",
    507     "labels": ["Value display/formatting", "Axis display"],
    508     "type": "boolean",
    509     "description": "Show date/time labels according to UTC (instead of local time)."
    510   },
    511   "labelsKMB": {
    512     "default": "false",
    513     "labels": ["Value display/formatting"],
    514     "type": "boolean",
    515     "description": "Show k/M/B for thousands/millions/billions on y-axis."
    516   },
    517   "rightGap": {
    518     "default": "5",
    519     "labels": ["Overall display"],
    520     "type": "integer",
    521     "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."
    522   },
    523   "drawAxesAtZero": {
    524     "default": "false",
    525     "labels": ["Axis display"],
    526     "type": "boolean",
    527     "description": "When set, draw the X axis at the Y=0 position and the Y axis at the X=0 position if those positions are inside the graph’s visible area. Otherwise, draw the axes at the bottom or left graph edge as usual."
    528   },
    529   "xRangePad": {
    530     "default": "0",
    531     "labels": ["Axis display"],
    532     "type": "float",
    533     "description": "Add the specified amount of extra space (in pixels) around the X-axis value range to ensure points at the edges remain visible."
    534   },
    535   "yRangePad": {
    536     "default": "null",
    537     "labels": ["Axis display"],
    538     "type": "float",
    539     "description": "If set, add the specified amount of extra space (in pixels) around the Y-axis value range to ensure points at the edges remain visible. If unset, use the traditional Y padding algorithm."
    540   },
    541   "axisLabelFormatter": {
    542     "default": "Depends on the data type",
    543     "labels": ["Axis display"],
    544     "type": "function(number or Date, granularity, opts, dygraph)",
    545     "parameters": [
    546       [ "number or date" , "Either a number (for a numeric axis) or a Date object (for a date axis)" ],
    547       [ "granularity" , "specifies how fine-grained the axis is. For date axes, this is a reference to the time granularity enumeration, defined in dygraph-tickers.js, e.g. Dygraph.WEEKLY." ],
    548       [ "opts" , "a function which provides access to various options on the dygraph, e.g. opts('labelsKMB')." ],
    549       [ "dygraph" , "the referenced graph" ]
    550     ],
    551     "description": "Function to call to format the tick values that appear along an axis. This is usually set on a <a href='per-axis.html'>per-axis</a> basis."
    552   },
    553   "clickCallback": {
    554     "snippet": "function(e, date_millis){<br>  alert(new Date(date_millis));<br>}",
    555     "default": "null",
    556     "labels": ["Callbacks"],
    557     "type": "function(e, x, points)",
    558     "parameters": [
    559       [ "e" , "The event object for the click" ],
    560       [ "x" , "The x value that was clicked (for dates, this is milliseconds since epoch)" ],
    561       [ "points" , "The closest points along that date. See <a href='#point_properties'>Point properties</a> for details." ]
    562     ],
    563     "description": "A function to call when the canvas is clicked."
    564   },
    565   "labels": {
    566     "default": "[\"X\", \"Y1\", \"Y2\", ...]*",
    567     "labels": ["Legend"],
    568     "type": "Array of strings",
    569     "description": "A name for each data series, including the independent (X) series. For CSV files and DataTable objections, this is determined by context. For raw data, this must be specified. If it is not, default values are supplied and a warning is logged."
    570   },
    571   "dateWindow": {
    572     "default": "Full range of the input is shown",
    573     "labels": ["Axis display"],
    574     "type": "Array of two numbers",
    575     "example": "[<br>  Date.parse('2006-01-01'),<br>  (new Date()).valueOf()<br>]",
    576     "description": "Initially zoom in on a section of the graph. Is of the form [earliest, latest], where earliest/latest are milliseconds since epoch. If the data for the x-axis is numeric, the values in dateWindow must also be numbers."
    577   },
    578   "showRoller": {
    579     "default": "false",
    580     "labels": ["Interactive Elements", "Rolling Averages"],
    581     "type": "boolean",
    582     "description": "If the rolling average period text box should be shown."
    583   },
    584   "sigma": {
    585     "default": "2.0",
    586     "labels": ["Error Bars"],
    587     "type": "float",
    588     "description": "When errorBars is set, shade this many standard deviations above/below each point."
    589   },
    590   "customBars": {
    591     "default": "false",
    592     "labels": ["CSV parsing", "Error Bars"],
    593     "type": "boolean",
    594     "description": "When set, parse each CSV cell as \"low;middle;high\". Error bars will be drawn for each point between low and high, with the series itself going through middle."
    595   },
    596   "colorValue": {
    597     "default": "1.0",
    598     "labels": ["Data Series Colors"],
    599     "type": "float (0.0 - 1.0)",
    600     "description": "If colors is not specified, value of the data series colors, as in hue/saturation/value. (0.0-1.0, default 0.5)"
    601   },
    602   "errorBars": {
    603     "default": "false",
    604     "labels": ["CSV parsing", "Error Bars"],
    605     "type": "boolean",
    606     "description": "Does the data contain standard deviations? Setting this to true alters the input format (see above)."
    607   },
    608   "displayAnnotations": {
    609     "default": "false",
    610     "labels": ["Annotations"],
    611     "type": "boolean",
    612     "description": "Only applies when Dygraphs is used as a GViz chart. Causes string columns following a data series to be interpreted as annotations on points in that series. This is the same format used by Google’s AnnotatedTimeLine chart."
    613   },
    614   "panEdgeFraction": {
    615     "default": "null",
    616     "labels": ["Axis display", "Interactive Elements"],
    617     "type": "float",
    618     "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."
    619   },
    620   "title": {
    621     "labels": ["Chart labels"],
    622     "type": "string",
    623     "default": "null",
    624     "description": "Text to display above the chart. You can supply any HTML for this value, not just text. If you wish to style it using CSS, use the “dygraph-label” or “dygraph-title” classes."
    625   },
    626   "titleHeight": {
    627     "default": "18",
    628     "labels": ["Chart labels"],
    629     "type": "integer",
    630     "description": "Height of the chart title, in pixels. This also controls the default font size of the title. If you style the title on your own, this controls how much space is set aside above the chart for the title’s div."
    631   },
    632   "xlabel": {
    633     "labels": ["Chart labels"],
    634     "type": "string",
    635     "default": "null",
    636     "description": "Text to display below the chart’s x-axis. You can supply any HTML for this value, not just text. If you wish to style it using CSS, use the “dygraph-label” or “dygraph-xlabel” classes."
    637   },
    638   "xLabelHeight": {
    639     "labels": ["Chart labels"],
    640     "type": "integer",
    641     "default": "18",
    642     "description": "Height of the x-axis label, in pixels. This also controls the default font size of the x-axis label. If you style the label on your own, this controls how much space is set aside below the chart for the x-axis label’s div."
    643   },
    644   "ylabel": {
    645     "labels": ["Chart labels"],
    646     "type": "string",
    647     "default": "null",
    648     "description": "Text to display to the left of the chart’s y-axis. You can supply any HTML for this value, not just text. If you wish to style it using CSS, use the “dygraph-label” or “dygraph-ylabel” classes. The text will be rotated 90 degrees by default, so CSS rules may behave in unintuitive ways. No additional space is set aside for a y-axis label. If you need more space, increase the width of the y-axis tick labels using the yAxisLabelWidth option. If you need a wider div for the y-axis label, either style it that way with CSS (but remember that it’s rotated, so width is controlled by the “height” property) or set the yLabelWidth option."
    649   },
    650   "y2label": {
    651     "labels": ["Chart labels"],
    652     "type": "string",
    653     "default": "null",
    654     "description": "Text to display to the right of the chart’s secondary y-axis. This label is only displayed if a secondary y-axis is present. See <a href='tests/two-axes.html'>this test</a> for an example of how to do this. The comments for the “ylabel” option generally apply here as well. This label gets a “dygraph-y2label” instead of a “dygraph-ylabel” class."
    655   },
    656   "yLabelWidth": {
    657     "labels": ["Chart labels"],
    658     "type": "integer",
    659     "default": "18",
    660     "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."
    661   },
    662   "drawGrid": {
    663     "default": "true for x and y, false for y2",
    664     "labels": ["Grid"],
    665     "type": "boolean",
    666     "description" : "Whether to display gridlines in the chart. This may be set on a per-axis basis to define the visibility of each axis’ grid separately."
    667   },
    668   "independentTicks": {
    669     "default": "true for y, false for y2",
    670     "labels": ["Axis display", "Grid"],
    671     "type": "boolean",
    672     "description" : "Only valid for y and y2, has no effect on x: This option defines whether the y axes should align their ticks or if they should be independent. Possible combinations: 1.) y=true, y2=false (default): y is the primary axis and the y2 ticks are aligned to the the ones of y. (only 1 grid) 2.) y=false, y2=true: y2 is the primary axis and the y ticks are aligned to the the ones of y2. (only 1 grid) 3.) y=true, y2=true: Both axis are independent and have their own ticks. (2 grids) 4.) y=false, y2=false: Invalid configuration causes an error."
    673   },
    674   "drawAxis": {
    675     "default": "true for x and y, false for y2",
    676     "labels": ["Axis display"],
    677     "type": "boolean",
    678     "description" : "Whether to draw the specified axis. This may be set on a per-axis basis to define the visibility of each axis separately. Setting this to false also prevents axis ticks from being drawn and reclaims the space for the chart grid/lines."
    679   },
    680   "gridLineWidth": {
    681     "default": "0.3",
    682     "labels": ["Grid"],
    683     "type": "float",
    684     "description" : "Thickness (in pixels) of the gridlines drawn under the chart. The vertical/horizontal gridlines can be turned off entirely by using the drawGrid option. This may be set on a per-axis basis to define each axis’ grid separately."
    685   },
    686   "axisLineWidth": {
    687     "default": "0.3",
    688     "labels": ["Axis display"],
    689     "type": "float",
    690     "description" : "Thickness (in pixels) of the x- and y-axis lines."
    691   },
    692   "axisLineColor": {
    693     "default": "black",
    694     "labels": ["Axis display"],
    695     "type": "string",
    696     "description" : "Color of the x- and y-axis lines. Accepts any value which the HTML canvas strokeStyle attribute understands, e.g. 'black' or 'rgb(0, 100, 255)'."
    697   },
    698   "fillAlpha": {
    699     "default": "0.15",
    700     "labels": ["Error Bars", "Data Series Colors"],
    701     "type": "float (0.0 - 1.0)",
    702     "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."
    703   },
    704   "axisLabelWidth": {
    705     "default": "50 (y-axis), 60 (x-axis)",
    706     "labels": ["Axis display", "Chart labels"],
    707     "type": "integer",
    708     "description" : "Width (in pixels) of the containing divs for x- and y-axis labels. For the y-axis, this also controls the width of the y-axis. Note that for the x-axis, this is independent from pixelsPerLabel, which controls the spacing between labels."
    709   },
    710   "sigFigs" : {
    711     "default": "null",
    712     "labels": ["Value display/formatting"],
    713     "type": "integer",
    714     "description": "By default, dygraphs displays numbers with a fixed number of digits after the decimal point. If you’d prefer to have a fixed number of significant figures, set this option to that number of sig figs. A value of 2, for instance, would cause 1 to be display as 1.0 and 1234 to be displayed as 1.23e+3."
    715   },
    716   "digitsAfterDecimal" : {
    717     "default": "2",
    718     "labels": ["Value display/formatting"],
    719     "type": "integer",
    720     "description": "Unless it’s run in scientific mode (see the <code>sigFigs</code> option), dygraphs displays numbers with <code>digitsAfterDecimal</code> digits after the decimal point. Trailing zeros are not displayed, so with a value of 2 you’ll get '0', '0.1', '0.12', '123.45' but not '123.456' (it will be rounded to '123.46'). Numbers with absolute value less than 0.1^digitsAfterDecimal (i.e. those which would show up as '0.00') will be displayed in scientific notation."
    721   },
    722   "maxNumberWidth" : {
    723     "default": "6",
    724     "labels": ["Value display/formatting"],
    725     "type": "integer",
    726     "description": "When displaying numbers in normal (not scientific) mode, large numbers will be displayed with many trailing zeros (e.g. 100000000 instead of 1e9). This can lead to unwieldy y-axis labels. If there are more than <code>maxNumberWidth</code> digits to the left of the decimal in a number, dygraphs will switch to scientific notation, even when not operating in scientific mode. If you’d like to see all those digits, set this to something large, like 20 or 30."
    727   },
    728   "file": {
    729     "default": "(set when constructed)",
    730     "labels": ["Data"],
    731     "type": "string (URL of CSV or CSV), GViz DataTable or 2D Array",
    732     "description": "Sets the data being displayed in the chart. This can only be set when calling updateOptions; it cannot be set from the constructor. For a full description of valid data formats, see the <a href='data.html'>Data Formats</a> page."
    733   },
    734   "timingName": {
    735     "default": "null",
    736     "labels": [ "Debugging", "Deprecated" ],
    737     "type": "string",
    738     "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."
    739   },
    740   "showRangeSelector": {
    741     "default": "false",
    742     "labels": ["Range Selector"],
    743     "type": "boolean",
    744     "description": "Show or hide the range selector widget."
    745   },
    746   "rangeSelectorHeight": {
    747     "default": "40",
    748     "labels": ["Range Selector"],
    749     "type": "integer",
    750     "description": "Height, in pixels, of the range selector widget. This option can only be specified at Dygraph creation time."
    751   },
    752   "rangeSelectorPlotStrokeColor": {
    753     "default": "#808FAB",
    754     "labels": ["Range Selector"],
    755     "type": "string",
    756     "description": "The range selector mini plot stroke color. This can be of the form \"#AABBCC\" or \"rgb(255,100,200)\" or \"yellow\". You can also specify null or \"\" to turn off stroke."
    757   },
    758   "rangeSelectorPlotFillColor": {
    759     "default": "#A7B1C4",
    760     "labels": ["Range Selector"],
    761     "type": "string",
    762     "description": "The range selector mini plot fill color. This can be of the form \"#AABBCC\" or \"rgb(255,100,200)\" or \"yellow\". You can also specify null or \"\" to turn off fill."
    763   },
    764   "rangeSelectorPlotFillGradientColor": {
    765     "default": "white",
    766     "labels": ["Range Selector"],
    767     "type": "string",
    768     "description": "The top color for the range selector mini plot fill color gradient. This can be of the form \"#AABBCC\" or \"rgb(255,100,200)\" or \"rgba(255,100,200,42)\" or \"yellow\". You can also specify null or \"\" to disable the gradient and fill with one single color."
    769   },
    770   "rangeSelectorBackgroundStrokeColor": {
    771     "default": "gray",
    772     "labels": ["Range Selector"],
    773     "type": "string",
    774     "description": "The color of the lines below and on both sides of the range selector mini plot. This can be of the form \"#AABBCC\" or \"rgb(255,100,200)\" or \"yellow\"."
    775   },
    776   "rangeSelectorBackgroundLineWidth": {
    777     "default": "1",
    778     "labels": ["Range Selector"],
    779     "type": "float",
    780     "description": "The width of the lines below and on both sides of the range selector mini plot."
    781   },
    782   "rangeSelectorPlotLineWidth": {
    783     "default": "1.5",
    784     "labels": ["Range Selector"],
    785     "type": "float",
    786     "description": "The width of the range selector mini plot line."
    787   },
    788   "rangeSelectorForegroundStrokeColor": {
    789     "default": "black",
    790     "labels": ["Range Selector"],
    791     "type": "string",
    792     "description": "The color of the lines in the interactive layer of the range selector. This can be of the form \"#AABBCC\" or \"rgb(255,100,200)\" or \"yellow\"."
    793   },
    794   "rangeSelectorForegroundLineWidth": {
    795     "default": "1",
    796     "labels": ["Range Selector"],
    797     "type": "float",
    798     "description": "The width the lines in the interactive layer of the range selector."
    799   },
    800   "rangeSelectorAlpha": {
    801     "default": "0.6",
    802     "labels": ["Range Selector"],
    803     "type": "float (0.0 - 1.0)",
    804     "description": "The transparency of the veil that is drawn over the unselected portions of the range selector mini plot. A value of 0 represents full transparency and the unselected portions of the mini plot will appear as normal. A value of 1 represents full opacity and the unselected portions of the mini plot will be hidden."
    805   },
    806   "rangeSelectorVeilColour": {
    807     "default": "null",
    808     "labels": ["Range Selector"],
    809     "type": "string",
    810     "description": "The fillStyle for the veil of the range selector (e.g. \"rgba(240, 240, 240, 0.6)\"); if set, the rangeSelectorAlpha option is ignored."
    811   },
    812   "showInRangeSelector": {
    813     "default": "null",
    814     "labels": ["Range Selector"],
    815     "type": "boolean",
    816     "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)."
    817   },
    818   "animatedZooms": {
    819     "default": "false",
    820     "labels": ["Interactive Elements"],
    821     "type": "boolean",
    822     "description": "Set this option to animate the transition between zoom windows. Applies to programmatic and interactive zooms. Note that if you also set a drawCallback, it will be called several times on each zoom. If you set a zoomCallback, it will only be called after the animation is complete."
    823   },
    824   "plotter": {
    825     "default": "[DygraphCanvasRenderer.Plotters.fillPlotter, DygraphCanvasRenderer.Plotters.errorPlotter, DygraphCanvasRenderer.Plotters.linePlotter]",
    826     "labels": ["Data Line display"],
    827     "type": "array or function",
    828     "description": "A function (or array of functions) which plot each data series on the chart. TODO(danvk): more details! May be set per-series."
    829   },
    830   "axes": {
    831     "default": "null",
    832     "labels": ["Configuration"],
    833     "type": "Object",
    834     "description": "Defines per-axis options. Valid keys are 'x', 'y' and 'y2'. Only some options may be set on a per-axis basis. If an option may be set in this way, it will be noted on this page. See also documentation on <a href='per-axis.html'>per-series and per-axis options</a>."
    835   },
    836   "series": {
    837     "default": "null",
    838     "labels": ["Series"],
    839     "type": "Object",
    840     "description": "Defines per-series options. Its keys match the y-axis label names, and the values are dictionaries themselves that contain options specific to that series."
    841   },
    842   "plugins": {
    843     "default": "[]",
    844     "labels": ["Configuration"],
    845     "type": "Array of plugins",
    846     "description": "Defines per-graph plugins. Useful for per-graph customization"
    847   },
    848   "dataHandler": {
    849     "default": "(depends on data)",
    850     "labels": ["Data"],
    851     "type": "Dygraph.DataHandler",
    852     "description": "Custom DataHandler. This is an advanced customisation. See <a href='datahandler-proposal.pdf'><tt>docs/datahandler-proposal.pdf</tt></a>."
    853   }
    854 }
    855 ;  // </JSON>
    856 // NOTE: in addition to parsing as JS, this snippet is expected to be valid
    857 // JSON. This assumption cannot be checked in JS, but it will be checked when
    858 // documentation is generated by the generate-documentation.py script. For the
    859 // most part, this just means that you should always use double quotes.
    860
    861 // Do a quick sanity check on the options reference.
    862 var warn = function(msg) { if (window.console) window.console.warn(msg); };
    863 var flds = ['type', 'default', 'description'];
    864 var valid_cats = [
    865  'Annotations',
    866  'Axis display',
    867  'Chart labels',
    868  'CSV parsing',
    869  'Callbacks',
    870  'Data',
    871  'Data Line display',
    872  'Data Series Colors',
    873  'Error Bars',
    874  'Grid',
    875  'Interactive Elements',
    876  'Range Selector',
    877  'Legend',
    878  'Overall display',
    879  'Rolling Averages',
    880  'Series',
    881  'Value display/formatting',
    882  'Zooming',
    883  'Debugging',
    884  'Configuration',
    885  'Deprecated'
    886 ];
    887 var i;
    888 var cats = {};
    889 for (i = 0; i < valid_cats.length; i++) cats[valid_cats[i]] = true;
    890
    891 for (var k in OPTIONS_REFERENCE) {
    892   if (!OPTIONS_REFERENCE.hasOwnProperty(k)) continue;
    893   var op = OPTIONS_REFERENCE[k];
    894   for (i = 0; i < flds.length; i++) {
    895     if (!op.hasOwnProperty(flds[i])) {
    896       warn('Option ' + k + ' missing "' + flds[i] + '" property');
    897     } else if (typeof(op[flds[i]]) != 'string') {
    898       warn(k + '.' + flds[i] + ' must be of type string');
    899     }
    900   }
    901   var labels = op.labels;
    902   if (typeof(labels) !== 'object') {
    903     warn('Option "' + k + '" is missing a "labels": [...] option');
    904   } else {
    905     for (i = 0; i < labels.length; i++) {
    906       if (!cats.hasOwnProperty(labels[i])) {
    907         warn('Option "' + k + '" has label "' + labels[i] +
    908              '", which is invalid.');
    909       }
    910     }
    911   }
    912 }
    913
    914 }
    915
    916 export default OPTIONS_REFERENCE;
    917