Only include visible series in range selector (#785)
[dygraphs.git] / src / dygraph-options-reference.js
CommitLineData
88e95c46
DV
1/**
2 * @license
3 * Copyright 2011 Dan Vanderkam (danvdk@gmail.com)
4 * MIT-licensed (http://opensource.org/licenses/MIT)
5 */
5108eb20 6
7fea22be
DV
7"use strict";
8
9var OPTIONS_REFERENCE = null;
10
11// For "production" code, this gets removed by uglifyjs.
12if (process.env.NODE_ENV != 'production') {
13
74a5af31
DV
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.
7fea22be 18OPTIONS_REFERENCE = // <JSON>
74a5af31
DV
19{
20 "xValueParser": {
21 "default": "parseFloat() or Date.parse()*",
22 "labels": ["CSV parsing"],
23 "type": "function(str) -> number",
24 "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."
25 },
26 "stackedGraph": {
27 "default": "false",
28 "labels": ["Data Line display"],
29 "type": "boolean",
30a5cfc6
KW
30 "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."
31 },
32 "stackedGraphNaNFill": {
33 "default": "all",
34 "labels": ["Data Line display"],
35 "type": "string",
36 "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)."
74a5af31
DV
37 },
38 "pointSize": {
39 "default": "1",
40 "labels": ["Data Line display"],
41 "type": "integer",
42 "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."
43 },
74a5af31
DV
44 "drawPoints": {
45 "default": "false",
46 "labels": ["Data Line display"],
47 "type": "boolean",
47e07d08 48 "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>."
78e58af4 49 },
a5a50727 50 "drawGapEdgePoints": {
19b84fe7
KW
51 "default": "false",
52 "labels": ["Data Line display"],
53 "type": "boolean",
54 "description": "Draw points at the edges of gaps in the data. This improves visibility of small data segments or other data irregularities."
55 },
78e58af4
RK
56 "drawPointCallback": {
57 "default": "null",
58 "labels": ["Data Line display"],
59 "type": "function(g, seriesName, canvasContext, cx, cy, color, pointSize)",
3fb9650f
RK
60 "parameters": [
61 [ "g" , "the reference graph" ],
62 [ "seriesName" , "the name of the series" ],
63 [ "canvasContext" , "the canvas to draw on" ],
64 [ "cx" , "center x coordinate" ],
65 [ "cy" , "center y coordinate" ],
66 [ "color" , "series color" ],
97adf46b 67 [ "pointSize" , "the radius of the image." ],
312f200d 68 [ "idx" , "the row-index of the point in the data."]
3fb9650f 69 ],
47e07d08 70 "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>"
74a5af31
DV
71 },
72 "height": {
73 "default": "320",
74 "labels": ["Overall display"],
75 "type": "integer",
47e07d08 76 "description": "Height, in pixels, of the chart. If the container div has been explicitly sized, this will be ignored."
74a5af31
DV
77 },
78 "zoomCallback": {
79 "default": "null",
80 "labels": ["Callbacks"],
81 "type": "function(minDate, maxDate, yRanges)",
b5bdd85b
RK
82 "parameters": [
83 [ "minDate" , "milliseconds since epoch" ],
84 [ "maxDate" , "milliseconds since epoch." ],
85 [ "yRanges" , "is an array of [bottom, top] pairs, one for each y-axis." ]
86 ],
bf7d192b 87 "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)."
74a5af31
DV
88 },
89 "pointClickCallback": {
3f2f472e
RK
90 "snippet": "function(e, point){<br>&nbsp;&nbsp;alert(point);<br>}",
91 "default": "null",
74a5af31 92 "labels": ["Callbacks", "Interactive Elements"],
3f2f472e 93 "type": "function(e, point)",
b5bdd85b
RK
94 "parameters": [
95 [ "e" , "the event object for the click" ],
96 [ "point" , "the point that was clicked See <a href='#point_properties'>Point properties</a> for details" ]
97 ],
98 "description": "A function to call when a data point is clicked. and the point that was clicked."
74a5af31 99 },
87f2fcd1 100 "color": {
74a5af31
DV
101 "default": "(see description)",
102 "labels": ["Data Series Colors"],
87f2fcd1
RK
103 "type": "string",
104 "example": "red",
105 "description": "A per-series color definition. Used in conjunction with, and overrides, the colors option."
48423521
RK
106 },
107 "colors": {
108 "default": "(see description)",
109 "labels": ["Data Series Colors"],
87f2fcd1
RK
110 "type": "array<string>",
111 "example": "['red', '#00FF00']",
112 "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."
74a5af31
DV
113 },
114 "connectSeparatedPoints": {
115 "default": "false",
116 "labels": ["Data Line display"],
117 "type": "boolean",
118 "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."
119 },
120 "highlightCallback": {
121 "default": "null",
122 "labels": ["Callbacks"],
5469113b 123 "type": "function(event, x, points, row, seriesName)",
b5bdd85b
RK
124 "description": "When set, this callback gets called every time a new point is highlighted.",
125 "parameters": [
126 ["event", "the JavaScript mousemove event"],
127 ["x", "the x-coordinate of the highlighted points"],
128 ["points", "an array of highlighted points: <code>[ {name: 'series', yval: y-value}, &hellip; ]</code>"],
5469113b
KW
129 ["row", "integer index of the highlighted row in the data table, starting from 0"],
130 ["seriesName", "name of the highlighted series, only present if highlightSeriesOpts is set."]
b5bdd85b 131 ]
74a5af31 132 },
5879307d 133 "drawHighlightPointCallback": {
78e58af4
RK
134 "default": "null",
135 "labels": ["Data Line display"],
136 "type": "function(g, seriesName, canvasContext, cx, cy, color, pointSize)",
3fb9650f
RK
137 "parameters": [
138 [ "g" , "the reference graph" ],
139 [ "seriesName" , "the name of the series" ],
140 [ "canvasContext" , "the canvas to draw on" ],
141 [ "cx" , "center x coordinate" ],
142 [ "cy" , "center y coordinate" ],
143 [ "color" , "series color" ],
97adf46b 144 [ "pointSize" , "the radius of the image." ],
312f200d 145 [ "idx" , "the row-index of the point in the data."]
3fb9650f 146 ],
47e07d08 147 "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>"
857a6931
KW
148 },
149 "highlightSeriesOpts": {
150 "default": "null",
151 "labels": ["Interactive Elements"],
152 "type": "Object",
153 "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 }."
154 },
afdb20d8 155 "highlightSeriesBackgroundAlpha": {
2a02e5dd 156 "default": "0.5",
857a6931 157 "labels": ["Interactive Elements"],
2a02e5dd 158 "type": "float",
afdb20d8 159 "description": "Fade the background while highlighting series. 1=fully visible background (disable fading), 0=hiddden background (show highlighted series only)."
74a5af31 160 },
1715eee9
SS
161 "highlightSeriesBackgroundColor": {
162 "default": "rgb(255, 255, 255)",
163 "labels": ["Interactive Elements"],
164 "type": "string",
165 "description": "Sets the background color used to fade out the series in conjunction with 'highlightSeriesBackgroundAlpha'."
166 },
74a5af31
DV
167 "includeZero": {
168 "default": "false",
169 "labels": ["Axis display"],
170 "type": "boolean",
171 "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"
172 },
173 "rollPeriod": {
174 "default": "1",
175 "labels": ["Error Bars", "Rolling Averages"],
176 "type": "integer &gt;= 1",
177 "description": "Number of days over which to average data. Discussed extensively above."
178 },
179 "unhighlightCallback": {
180 "default": "null",
181 "labels": ["Callbacks"],
182 "type": "function(event)",
b5bdd85b
RK
183 "parameters": [
184 [ "event" , "the mouse event" ]
185 ],
186 "description": "When set, this callback gets called every time the user stops highlighting any point by mousing out of the graph."
74a5af31
DV
187 },
188 "axisTickSize": {
189 "default": "3.0",
190 "labels": ["Axis display"],
191 "type": "number",
192 "description": "The size of the line to display next to each tick mark on x- or y-axes."
193 },
194 "labelsSeparateLines": {
195 "default": "false",
196 "labels": ["Legend"],
197 "type": "boolean",
198 "description": "Put <code>&lt;br/&gt;</code> between lines in the label string. Often used in conjunction with <strong>labelsDiv</strong>."
199 },
48e614ac
DV
200 "valueFormatter": {
201 "default": "Depends on the type of your data.",
202 "labels": ["Legend", "Value display/formatting"],
08be117f 203 "type": "function(num or millis, opts, seriesName, dygraph, row, col)",
575b2dcd
DV
204 "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. .",
205 "parameters": [
206 ["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."],
207 ["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."],
208 ["seriesName", "The name of the series from which the point came, e.g. 'X', 'Y', 'A', etc."],
209 ["dygraph", "The dygraph object for which the formatting is being done"],
210 ["row", "The row of the data from which this point comes. g.getValue(row, 0) will return the x-value for this point."],
211 ["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."]
212 ]
74a5af31 213 },
74a5af31
DV
214 "annotationMouseOverHandler": {
215 "default": "null",
216 "labels": ["Annotations"],
217 "type": "function(annotation, point, dygraph, event)",
218 "description": "If provided, this function is called whenever the user mouses over an annotation."
219 },
220 "annotationMouseOutHandler": {
221 "default": "null",
222 "labels": ["Annotations"],
223 "type": "function(annotation, point, dygraph, event)",
b5bdd85b
RK
224 "parameters": [
225 [ "annotation" , "the annotation left" ],
226 [ "point" , "the point associated with the annotation" ],
227 [ "dygraph" , "the reference graph" ],
228 [ "event" , "the mouse event" ]
229 ],
74a5af31
DV
230 "description": "If provided, this function is called whenever the user mouses out of an annotation."
231 },
232 "annotationClickHandler": {
233 "default": "null",
234 "labels": ["Annotations"],
235 "type": "function(annotation, point, dygraph, event)",
b5bdd85b
RK
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 ],
74a5af31
DV
242 "description": "If provided, this function is called whenever the user clicks on an annotation."
243 },
244 "annotationDblClickHandler": {
245 "default": "null",
246 "labels": ["Annotations"],
247 "type": "function(annotation, point, dygraph, event)",
b5bdd85b
RK
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 ],
74a5af31
DV
254 "description": "If provided, this function is called whenever the user double-clicks on an annotation."
255 },
256 "drawCallback": {
257 "default": "null",
258 "labels": ["Callbacks"],
259 "type": "function(dygraph, is_initial)",
b5bdd85b
RK
260 "parameters": [
261 [ "dygraph" , "The graph being drawn" ],
262 [ "is_initial" , "True if this is the initial draw, false for subsequent draws." ]
263 ],
264 "description": "When set, this callback gets called every time the dygraph is drawn. This includes the initial draw, after zooming and repeatedly while panning."
74a5af31
DV
265 },
266 "labelsKMG2": {
267 "default": "false",
268 "labels": ["Value display/formatting"],
269 "type": "boolean",
270 "description": "Show k/M/G for kilo/Mega/Giga on y-axis. This is different than <code>labelsKMB</code> in that it uses base 2, not 10."
271 },
272 "delimiter": {
273 "default": ",",
274 "labels": ["CSV parsing"],
275 "type": "string",
276 "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."
277 },
278 "axisLabelFontSize": {
279 "default": "14",
280 "labels": ["Axis display"],
281 "type": "integer",
282 "description": "Size of the font (in pixels) to use in the axis labels, both x- and y-axis."
283 },
284 "underlayCallback": {
285 "default": "null",
286 "labels": ["Callbacks"],
1987a3df 287 "type": "function(context, area, dygraph)",
b5bdd85b 288 "parameters": [
1987a3df
DV
289 [ "context" , "the canvas drawing context on which to draw" ],
290 [ "area" , "An object with {x,y,w,h} properties describing the drawing area." ],
b5bdd85b
RK
291 [ "dygraph" , "the reference graph" ]
292 ],
74a5af31
DV
293 "description": "When set, this callback gets called before the chart is drawn. It details on how to use this."
294 },
295 "width": {
296 "default": "480",
297 "labels": ["Overall display"],
298 "type": "integer",
299 "description": "Width, in pixels, of the chart. If the container div has been explicitly sized, this will be ignored."
300 },
301 "interactionModel": {
302 "default": "...",
303 "labels": ["Interactive Elements"],
304 "type": "Object",
305 "description": "TODO(konigsberg): document this"
306 },
758a629f 307 "ticker": {
74a5af31
DV
308 "default": "Dygraph.dateTicker or Dygraph.numericTicks",
309 "labels": ["Axis display"],
48e614ac 310 "type": "function(min, max, pixels, opts, dygraph, vals) -> [{v: ..., label: ...}, ...]",
b5bdd85b
RK
311 "parameters": [
312 [ "min" , "" ],
313 [ "max" , "" ],
314 [ "pixels" , "" ],
315 [ "opts" , "" ],
316 [ "dygraph" , "the reference graph" ],
317 [ "vals" , "" ]
318 ],
758a629f 319 "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."
74a5af31 320 },
74a5af31
DV
321 "xAxisHeight": {
322 "default": "(null)",
323 "labels": ["Axis display"],
324 "type": "integer",
325 "description": "Height, in pixels, of the x-axis. If not set explicitly, this is computed based on axisLabelFontSize and axisTickSize."
326 },
327 "showLabelsOnHighlight": {
328 "default": "true",
329 "labels": ["Interactive Elements", "Legend"],
330 "type": "boolean",
331 "description": "Whether to show the legend upon mouseover."
332 },
333 "axis": {
334 "default": "(none)",
335 "labels": ["Axis display"],
8498e5e8
DV
336 "type": "string",
337 "description": "Set to either 'y1' or 'y2' to assign a series to a y-axis (primary or secondary). Must be set per-series."
74a5af31 338 },
48e614ac 339 "pixelsPerLabel": {
d8dd8c2b 340 "default": "70 (x-axis) or 30 (y-axes)",
74a5af31
DV
341 "labels": ["Axis display", "Grid"],
342 "type": "integer",
48e614ac 343 "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."
74a5af31
DV
344 },
345 "labelsDiv": {
346 "default": "null",
347 "labels": ["Legend"],
348 "type": "DOM element or string",
349 "example": "<code style='font-size: small'>document.getElementById('foo')</code>or<code>'foo'",
350 "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."
351 },
352 "fractions": {
353 "default": "false",
354 "labels": ["CSV parsing", "Error Bars"],
355 "type": "boolean",
356 "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)."
357 },
358 "logscale": {
359 "default": "false",
360 "labels": ["Axis display"],
361 "type": "boolean",
5b9b2142 362 "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."
74a5af31
DV
363 },
364 "strokeWidth": {
365 "default": "1.0",
366 "labels": ["Data Line display"],
475f7420 367 "type": "float",
74a5af31
DV
368 "example": "0.5, 2.0",
369 "description": "The width of the lines connecting data points. This can be used to increase the contrast or some graphs."
370 },
79253bd0 371 "strokePattern": {
372 "default": "null",
373 "labels": ["Data Line display"],
374 "type": "array<integer>",
375 "example": "[10, 2, 5, 2]",
e2c21500 376 "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."
79253bd0 377 },
857a6931
KW
378 "strokeBorderWidth": {
379 "default": "null",
380 "labels": ["Data Line display"],
475f7420
KW
381 "type": "float",
382 "example": "1.0",
857a6931
KW
383 "description": "Draw a border around graph lines to make crossing lines more easily distinguishable. Useful for graphs with many lines."
384 },
385 "strokeBorderColor": {
386 "default": "white",
387 "labels": ["Data Line display"],
388 "type": "string",
389 "example": "red, #ccffdd",
390 "description": "Color for the line border used if strokeBorderWidth is set."
391 },
74a5af31
DV
392 "wilsonInterval": {
393 "default": "true",
394 "labels": ["Error Bars"],
395 "type": "boolean",
396 "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."
397 },
398 "fillGraph": {
399 "default": "false",
400 "labels": ["Data Line display"],
401 "type": "boolean",
cf8c87d4 402 "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."
74a5af31
DV
403 },
404 "highlightCircleSize": {
405 "default": "3",
406 "labels": ["Interactive Elements"],
407 "type": "integer",
408 "description": "The size in pixels of the dot drawn over highlighted points."
409 },
410 "gridLineColor": {
411 "default": "rgb(128,128,128)",
412 "labels": ["Grid"],
413 "type": "red, blue",
86e9b1eb 414 "description": "The color of the gridlines. This may be set on a per-axis basis to define each axis' grid separately."
74a5af31 415 },
8887663f
DV
416 "gridLinePattern": {
417 "default": "null",
418 "labels": ["Grid"],
419 "type": "array<integer>",
420 "example": "[10, 2, 5, 2]",
421 "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."
422 },
74a5af31
DV
423 "visibility": {
424 "default": "[true, true, ...]",
425 "labels": ["Data Line display"],
426 "type": "Array of booleans",
427 "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."
428 },
429 "valueRange": {
430 "default": "Full range of the input is shown",
431 "labels": ["Axis display"],
432 "type": "Array of two numbers",
433 "example": "[10, 110]",
1e1233b3 434 "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)"
74a5af31 435 },
74a5af31
DV
436 "colorSaturation": {
437 "default": "1.0",
438 "labels": ["Data Series Colors"],
439 "type": "float (0.0 - 1.0)",
440 "description": "If <strong>colors</strong> is not specified, saturation of the automatically-generated data series colors."
441 },
74a5af31
DV
442 "hideOverlayOnMouseOut": {
443 "default": "true",
444 "labels": ["Interactive Elements", "Legend"],
445 "type": "boolean",
446 "description": "Whether to hide the legend when the mouse leaves the chart area."
447 },
74a5af31
DV
448 "legend": {
449 "default": "onmouseover",
450 "labels": ["Legend"],
451 "type": "string",
a22cc809 452 "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."
74a5af31 453 },
77ad1333
DV
454 "legendFormatter": {
455 "default": "null",
456 "labels": ["Legend"],
ac928d20
DV
457 "type": "function(data): string",
458 "params": [
459 [ "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." ]
460 ],
461 "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."
77ad1333 462 },
74a5af31
DV
463 "labelsShowZeroValues": {
464 "default": "true",
465 "labels": ["Legend"],
466 "type": "boolean",
467 "description": "Show zero value labels in the labelsDiv."
468 },
469 "stepPlot": {
470 "default": "false",
471 "labels": ["Data Line display"],
472 "type": "boolean",
104d87c5 473 "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."
74a5af31 474 },
8c0599e3 475 "labelsUTC": {
872a6a00 476 "default": "false",
8c0599e3 477 "labels": ["Value display/formatting", "Axis display"],
872a6a00
DV
478 "type": "boolean",
479 "description": "Show date/time labels according to UTC (instead of local time)."
480 },
74a5af31
DV
481 "labelsKMB": {
482 "default": "false",
483 "labels": ["Value display/formatting"],
484 "type": "boolean",
485 "description": "Show K/M/B for thousands/millions/billions on y-axis."
486 },
487 "rightGap": {
488 "default": "5",
489 "labels": ["Overall display"],
490 "type": "integer",
491 "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."
492 },
493 "avoidMinZero": {
494 "default": "false",
fa460473 495 "labels": ["Deprecated"],
74a5af31 496 "type": "boolean",
fa460473 497 "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."
74a5af31 498 },
f4b87da2
KW
499 "drawAxesAtZero": {
500 "default": "false",
501 "labels": ["Axis display"],
502 "type": "boolean",
503 "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."
504 },
fa460473
KW
505 "xRangePad": {
506 "default": "0",
507 "labels": ["Axis display"],
508 "type": "float",
509 "description": "Add the specified amount of extra space (in pixels) around the X-axis value range to ensure points at the edges remain visible."
510 },
511 "yRangePad": {
512 "default": "null",
513 "labels": ["Axis display"],
514 "type": "float",
515 "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."
516 },
48e614ac
DV
517 "axisLabelFormatter": {
518 "default": "Depends on the data type",
519 "labels": ["Axis display"],
520 "type": "function(number or Date, granularity, opts, dygraph)",
b5bdd85b
RK
521 "parameters": [
522 [ "number or date" , "Either a number (for a numeric axis) or a Date object (for a date axis)" ],
523 [ "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." ],
524 [ "opts" , "a function which provides access to various options on the dygraph, e.g. opts('labelsKMB')." ],
525 [ "dygraph" , "the referenced graph" ]
526 ],
527 "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."
74a5af31
DV
528 },
529 "clickCallback": {
e6e12f18 530 "snippet": "function(e, date_millis){<br>&nbsp;&nbsp;alert(new Date(date_millis));<br>}",
74a5af31
DV
531 "default": "null",
532 "labels": ["Callbacks"],
e6e12f18 533 "type": "function(e, x, points)",
b5bdd85b
RK
534 "parameters": [
535 [ "e" , "The event object for the click" ],
536 [ "x" , "The x value that was clicked (for dates, this is milliseconds since epoch)" ],
537 [ "points" , "The closest points along that date. See <a href='#point_properties'>Point properties</a> for details." ]
538 ],
539 "description": "A function to call when the canvas is clicked."
74a5af31 540 },
74a5af31
DV
541 "labels": {
542 "default": "[\"X\", \"Y1\", \"Y2\", ...]*",
543 "labels": ["Legend"],
544 "type": "array<string>",
545 "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."
546 },
547 "dateWindow": {
548 "default": "Full range of the input is shown",
549 "labels": ["Axis display"],
b78c3349 550 "type": "Array of two numbers",
74a5af31
DV
551 "example": "[<br>&nbsp;&nbsp;Date.parse('2006-01-01'),<br>&nbsp;&nbsp;(new Date()).valueOf()<br>]",
552 "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."
553 },
554 "showRoller": {
555 "default": "false",
556 "labels": ["Interactive Elements", "Rolling Averages"],
557 "type": "boolean",
558 "description": "If the rolling average period text box should be shown."
559 },
560 "sigma": {
561 "default": "2.0",
562 "labels": ["Error Bars"],
563 "type": "float",
564 "description": "When errorBars is set, shade this many standard deviations above/below each point."
565 },
566 "customBars": {
567 "default": "false",
568 "labels": ["CSV parsing", "Error Bars"],
569 "type": "boolean",
570 "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."
571 },
572 "colorValue": {
573 "default": "1.0",
574 "labels": ["Data Series Colors"],
575 "type": "float (0.0 - 1.0)",
576 "description": "If colors is not specified, value of the data series colors, as in hue/saturation/value. (0.0-1.0, default 0.5)"
577 },
578 "errorBars": {
579 "default": "false",
580 "labels": ["CSV parsing", "Error Bars"],
581 "type": "boolean",
582 "description": "Does the data contain standard deviations? Setting this to true alters the input format (see above)."
583 },
584 "displayAnnotations": {
585 "default": "false",
586 "labels": ["Annotations"],
587 "type": "boolean",
588 "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."
589 },
590 "panEdgeFraction": {
591 "default": "null",
592 "labels": ["Axis display", "Interactive Elements"],
593 "type": "float",
74a5af31
DV
594 "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."
595 },
596 "title": {
597 "labels": ["Chart labels"],
598 "type": "string",
599 "default": "null",
600 "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."
601 },
602 "titleHeight": {
603 "default": "18",
604 "labels": ["Chart labels"],
605 "type": "integer",
606 "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."
607 },
608 "xlabel": {
609 "labels": ["Chart labels"],
610 "type": "string",
611 "default": "null",
612 "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."
613 },
614 "xLabelHeight": {
615 "labels": ["Chart labels"],
616 "type": "integer",
617 "default": "18",
618 "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."
619 },
620 "ylabel": {
621 "labels": ["Chart labels"],
622 "type": "string",
623 "default": "null",
624 "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."
625 },
d0c39108
DV
626 "y2label": {
627 "labels": ["Chart labels"],
628 "type": "string",
629 "default": "null",
630 "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='http://dygraphs.com/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."
631 },
74a5af31
DV
632 "yLabelWidth": {
633 "labels": ["Chart labels"],
634 "type": "integer",
635 "default": "18",
636 "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."
637 },
638 "isZoomedIgnoreProgrammaticZoom" : {
639 "default": "false",
640 "labels": ["Zooming"],
641 "type": "boolean",
642 "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."
643 },
86e9b1eb 644 "drawGrid": {
97adf46b
DE
645 "default": "true for x and y, false for y2",
646 "labels": ["Grid"],
647 "type": "boolean",
648 "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."
86e9b1eb
DE
649 },
650 "independentTicks": {
6c5f8774 651 "default": "true for y, false for y2",
97adf46b
DE
652 "labels": ["Axis display", "Grid"],
653 "type": "boolean",
6c5f8774 654 "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."
74a5af31 655 },
7f6a7190
RK
656 "drawAxis": {
657 "default": "true for x and y, false for y2",
658 "labels": ["Axis display"],
659 "type": "boolean",
660 "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."
74a5af31
DV
661 },
662 "gridLineWidth": {
663 "default": "0.3",
664 "labels": ["Grid"],
665 "type": "float",
bfb3e0a4 666 "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."
74a5af31
DV
667 },
668 "axisLineWidth": {
669 "default": "0.3",
670 "labels": ["Axis display"],
671 "type": "float",
672 "description" : "Thickness (in pixels) of the x- and y-axis lines."
673 },
674 "axisLineColor": {
675 "default": "black",
676 "labels": ["Axis display"],
677 "type": "string",
678 "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)'."
679 },
680 "fillAlpha": {
681 "default": "0.15",
682 "labels": ["Error Bars", "Data Series Colors"],
683 "type": "float (0.0 - 1.0)",
684 "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."
685 },
74a5af31 686 "axisLabelWidth": {
d8dd8c2b 687 "default": "50 (y-axis), 60 (x-axis)",
74a5af31
DV
688 "labels": ["Axis display", "Chart labels"],
689 "type": "integer",
d8dd8c2b 690 "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."
74a5af31
DV
691 },
692 "sigFigs" : {
693 "default": "null",
694 "labels": ["Value display/formatting"],
695 "type": "integer",
696 "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."
697 },
698 "digitsAfterDecimal" : {
699 "default": "2",
700 "labels": ["Value display/formatting"],
701 "type": "integer",
702 "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."
703 },
704 "maxNumberWidth" : {
705 "default": "6",
706 "labels": ["Value display/formatting"],
707 "type": "integer",
708 "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."
709 },
710 "file": {
711 "default": "(set when constructed)",
712 "labels": ["Data"],
713 "type": "string (URL of CSV or CSV), GViz DataTable or 2D Array",
714 "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='http://dygraphs.com/data.html'>Data Formats</a> page."
7153e001
DV
715 },
716 "timingName": {
717 "default": "null",
718 "labels": [ "Debugging" ],
719 "type": "string",
720 "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."
ccd9d7c2
PF
721 },
722 "showRangeSelector": {
723 "default": "false",
2555a4ed 724 "labels": ["Range Selector"],
ccd9d7c2 725 "type": "boolean",
0d216a60 726 "description": "Show or hide the range selector widget."
ccd9d7c2
PF
727 },
728 "rangeSelectorHeight": {
729 "default": "40",
2555a4ed 730 "labels": ["Range Selector"],
ccd9d7c2
PF
731 "type": "integer",
732 "description": "Height, in pixels, of the range selector widget. This option can only be specified at Dygraph creation time."
733 },
734 "rangeSelectorPlotStrokeColor": {
735 "default": "#808FAB",
2555a4ed 736 "labels": ["Range Selector"],
ccd9d7c2
PF
737 "type": "string",
738 "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."
739 },
740 "rangeSelectorPlotFillColor": {
741 "default": "#A7B1C4",
2555a4ed 742 "labels": ["Range Selector"],
ccd9d7c2
PF
743 "type": "string",
744 "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."
b1a3b195 745 },
79cb28dd 746 "rangeSelectorPlotFillGradientColor": {
747 "default": "white",
2555a4ed 748 "labels": ["Range Selector"],
79cb28dd 749 "type": "string",
750 "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."
751 },
fb24d32c 752 "rangeSelectorBackgroundStrokeColor": {
b77d7a56 753 "default": "gray",
2555a4ed 754 "labels": ["Range Selector"],
b77d7a56 755 "type": "string",
756 "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\"."
757 },
fb24d32c 758 "rangeSelectorBackgroundLineWidth": {
b77d7a56 759 "default": "1",
2555a4ed 760 "labels": ["Range Selector"],
b77d7a56 761 "type": "float",
762 "description": "The width of the lines below and on both sides of the range selector mini plot."
763 },
764 "rangeSelectorPlotLineWidth": {
765 "default": "1.5",
2555a4ed 766 "labels": ["Range Selector"],
b77d7a56 767 "type": "float",
768 "description": "The width of the range selector mini plot line."
b77d7a56 769 },
fb24d32c 770 "rangeSelectorForegroundStrokeColor": {
b77d7a56 771 "default": "black",
2555a4ed 772 "labels": ["Range Selector"],
b77d7a56 773 "type": "string",
774 "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\"."
775 },
fb24d32c 776 "rangeSelectorForegroundLineWidth": {
b77d7a56 777 "default": "1",
2555a4ed 778 "labels": ["Range Selector"],
b77d7a56 779 "type": "float",
780 "description": "The width the lines in the interactive layer of the range selector."
781 },
782 "rangeSelectorAlpha": {
783 "default": "0.6",
2555a4ed 784 "labels": ["Range Selector"],
b77d7a56 785 "type": "float (0.0 - 1.0)",
786 "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."
787 },
0a0885d1 788 "showInRangeSelector": {
1085dbce 789 "default": "null",
2555a4ed 790 "labels": ["Range Selector"],
0a0885d1 791 "type": "boolean",
6ed703fd 792 "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)."
1085dbce 793 },
b1a3b195
DV
794 "animatedZooms": {
795 "default": "false",
796 "labels": ["Interactive Elements"],
797 "type": "boolean",
798 "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."
38e3d209
DV
799 },
800 "plotter": {
801 "default": "[DygraphCanvasRenderer.Plotters.fillPlotter, DygraphCanvasRenderer.Plotters.errorPlotter, DygraphCanvasRenderer.Plotters.linePlotter]",
802 "labels": ["Data Line display"],
803 "type": "array or function",
804 "description": "A function (or array of functions) which plot each data series on the chart. TODO(danvk): more details! May be set per-series."
56bccd4d 805 },
8887663f
DV
806 "axes": {
807 "default": "null",
808 "labels": ["Configuration"],
809 "type": "Object",
810 "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='http://dygraphs.com/per-axis.html'>per-series and per-axis options</a>."
811 },
73e953cd
RK
812 "series": {
813 "default": "null",
814 "labels": ["Series"],
38f280e5 815 "type": "Object",
0a5aa490 816 "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."
d9fbba56
RK
817 },
818 "plugins": {
819 "default": "[]",
820 "labels": ["Configuration"],
eced46cf 821 "type": "Array<plugin>",
3ea41d86
DV
822 "description": "Defines per-graph plugins. Useful for per-graph customization"
823 },
824 "dataHandler": {
825 "default": "(depends on data)",
826 "labels": ["Data"],
827 "type": "Dygraph.DataHandler",
828 "description": "Custom DataHandler. This is an advanced customization. See http://bit.ly/151E7Aq."
73e953cd 829 }
74a5af31
DV
830}
831; // </JSON>
832// NOTE: in addition to parsing as JS, this snippet is expected to be valid
833// JSON. This assumption cannot be checked in JS, but it will be checked when
834// documentation is generated by the generate-documentation.py script. For the
835// most part, this just means that you should always use double quotes.
836
837// Do a quick sanity check on the options reference.
7fea22be
DV
838var warn = function(msg) { if (window.console) window.console.warn(msg); };
839var flds = ['type', 'default', 'description'];
840var valid_cats = [
841 'Annotations',
842 'Axis display',
843 'Chart labels',
844 'CSV parsing',
845 'Callbacks',
846 'Data',
847 'Data Line display',
848 'Data Series Colors',
849 'Error Bars',
850 'Grid',
851 'Interactive Elements',
852 'Range Selector',
853 'Legend',
854 'Overall display',
855 'Rolling Averages',
856 'Series',
857 'Value display/formatting',
858 'Zooming',
859 'Debugging',
860 'Configuration',
861 'Deprecated'
862];
863var i;
864var cats = {};
865for (i = 0; i < valid_cats.length; i++) cats[valid_cats[i]] = true;
74a5af31 866
7fea22be
DV
867for (var k in OPTIONS_REFERENCE) {
868 if (!OPTIONS_REFERENCE.hasOwnProperty(k)) continue;
869 var op = OPTIONS_REFERENCE[k];
870 for (i = 0; i < flds.length; i++) {
871 if (!op.hasOwnProperty(flds[i])) {
872 warn('Option ' + k + ' missing "' + flds[i] + '" property');
873 } else if (typeof(op[flds[i]]) != 'string') {
874 warn(k + '.' + flds[i] + ' must be of type string');
74a5af31 875 }
7fea22be
DV
876 }
877 var labels = op.labels;
878 if (typeof(labels) !== 'object') {
879 warn('Option "' + k + '" is missing a "labels": [...] option');
880 } else {
881 for (i = 0; i < labels.length; i++) {
882 if (!cats.hasOwnProperty(labels[i])) {
883 warn('Option "' + k + '" has label "' + labels[i] +
884 '", which is invalid.');
74a5af31
DV
885 }
886 }
887 }
7fea22be
DV
888}
889
890}
891
892export default OPTIONS_REFERENCE;