setMilliseconds() doesn't return this.
[dygraphs.git] / 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
758a629f
DV
7/*jshint globalstrict: true */
8/*global Dygraph:false */
9
74a5af31
DV
10// NOTE: in addition to parsing as JS, this snippet is expected to be valid
11// JSON. This assumption cannot be checked in JS, but it will be checked when
12// documentation is generated by the generate-documentation.py script. For the
13// most part, this just means that you should always use double quotes.
14Dygraph.OPTIONS_REFERENCE = // <JSON>
15{
16 "xValueParser": {
17 "default": "parseFloat() or Date.parse()*",
18 "labels": ["CSV parsing"],
19 "type": "function(str) -> number",
20 "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."
21 },
22 "stackedGraph": {
23 "default": "false",
24 "labels": ["Data Line display"],
25 "type": "boolean",
26 "description": "If set, stack series on top of one another rather than drawing them independently."
27 },
28 "pointSize": {
29 "default": "1",
30 "labels": ["Data Line display"],
31 "type": "integer",
32 "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."
33 },
34 "labelsDivStyles": {
35 "default": "null",
36 "labels": ["Legend"],
37 "type": "{}",
e2c21500 38 "description": "Additional styles to apply to the currently-highlighted points div. For example, { 'fontWeight': 'bold' } will make the labels bold. In general, it is better to use CSS to style the .dygraph-legend class than to use this property."
74a5af31
DV
39 },
40 "drawPoints": {
41 "default": "false",
42 "labels": ["Data Line display"],
43 "type": "boolean",
47e07d08 44 "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
RK
45 },
46 "drawPointCallback": {
47 "default": "null",
48 "labels": ["Data Line display"],
49 "type": "function(g, seriesName, canvasContext, cx, cy, color, pointSize)",
3fb9650f
RK
50 "parameters": [
51 [ "g" , "the reference graph" ],
52 [ "seriesName" , "the name of the series" ],
53 [ "canvasContext" , "the canvas to draw on" ],
54 [ "cx" , "center x coordinate" ],
55 [ "cy" , "center y coordinate" ],
56 [ "color" , "series color" ],
57 [ "pointSize" , "the radius of the image." ]
58 ],
47e07d08 59 "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
60 },
61 "height": {
62 "default": "320",
63 "labels": ["Overall display"],
64 "type": "integer",
47e07d08 65 "description": "Height, in pixels, of the chart. If the container div has been explicitly sized, this will be ignored."
74a5af31
DV
66 },
67 "zoomCallback": {
68 "default": "null",
69 "labels": ["Callbacks"],
70 "type": "function(minDate, maxDate, yRanges)",
b5bdd85b
RK
71 "parameters": [
72 [ "minDate" , "milliseconds since epoch" ],
73 [ "maxDate" , "milliseconds since epoch." ],
74 [ "yRanges" , "is an array of [bottom, top] pairs, one for each y-axis." ]
75 ],
47e07d08 76 "description": "A function to call when the zoom window is changed (either by zooming in or out)."
74a5af31
DV
77 },
78 "pointClickCallback": {
3f2f472e
RK
79 "snippet": "function(e, point){<br>&nbsp;&nbsp;alert(point);<br>}",
80 "default": "null",
74a5af31 81 "labels": ["Callbacks", "Interactive Elements"],
3f2f472e 82 "type": "function(e, point)",
b5bdd85b
RK
83 "parameters": [
84 [ "e" , "the event object for the click" ],
85 [ "point" , "the point that was clicked See <a href='#point_properties'>Point properties</a> for details" ]
86 ],
87 "description": "A function to call when a data point is clicked. and the point that was clicked."
74a5af31
DV
88 },
89 "colors": {
90 "default": "(see description)",
91 "labels": ["Data Series Colors"],
92 "type": "array<string>",
93 "example": "['red', '#00FF00']",
94 "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."
95 },
96 "connectSeparatedPoints": {
97 "default": "false",
98 "labels": ["Data Line display"],
99 "type": "boolean",
100 "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."
101 },
102 "highlightCallback": {
103 "default": "null",
104 "labels": ["Callbacks"],
5469113b 105 "type": "function(event, x, points, row, seriesName)",
b5bdd85b
RK
106 "description": "When set, this callback gets called every time a new point is highlighted.",
107 "parameters": [
108 ["event", "the JavaScript mousemove event"],
109 ["x", "the x-coordinate of the highlighted points"],
110 ["points", "an array of highlighted points: <code>[ {name: 'series', yval: y-value}, &hellip; ]</code>"],
5469113b
KW
111 ["row", "integer index of the highlighted row in the data table, starting from 0"],
112 ["seriesName", "name of the highlighted series, only present if highlightSeriesOpts is set."]
b5bdd85b 113 ]
74a5af31 114 },
5879307d 115 "drawHighlightPointCallback": {
78e58af4
RK
116 "default": "null",
117 "labels": ["Data Line display"],
118 "type": "function(g, seriesName, canvasContext, cx, cy, color, pointSize)",
3fb9650f
RK
119 "parameters": [
120 [ "g" , "the reference graph" ],
121 [ "seriesName" , "the name of the series" ],
122 [ "canvasContext" , "the canvas to draw on" ],
123 [ "cx" , "center x coordinate" ],
124 [ "cy" , "center y coordinate" ],
125 [ "color" , "series color" ],
126 [ "pointSize" , "the radius of the image." ]
127 ],
47e07d08 128 "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
129 },
130 "highlightSeriesOpts": {
131 "default": "null",
132 "labels": ["Interactive Elements"],
133 "type": "Object",
134 "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 }."
135 },
afdb20d8 136 "highlightSeriesBackgroundAlpha": {
2a02e5dd 137 "default": "0.5",
857a6931 138 "labels": ["Interactive Elements"],
2a02e5dd 139 "type": "float",
afdb20d8 140 "description": "Fade the background while highlighting series. 1=fully visible background (disable fading), 0=hiddden background (show highlighted series only)."
74a5af31
DV
141 },
142 "includeZero": {
143 "default": "false",
144 "labels": ["Axis display"],
145 "type": "boolean",
146 "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"
147 },
148 "rollPeriod": {
149 "default": "1",
150 "labels": ["Error Bars", "Rolling Averages"],
151 "type": "integer &gt;= 1",
152 "description": "Number of days over which to average data. Discussed extensively above."
153 },
154 "unhighlightCallback": {
155 "default": "null",
156 "labels": ["Callbacks"],
157 "type": "function(event)",
b5bdd85b
RK
158 "parameters": [
159 [ "event" , "the mouse event" ]
160 ],
161 "description": "When set, this callback gets called every time the user stops highlighting any point by mousing out of the graph."
74a5af31
DV
162 },
163 "axisTickSize": {
164 "default": "3.0",
165 "labels": ["Axis display"],
166 "type": "number",
167 "description": "The size of the line to display next to each tick mark on x- or y-axes."
168 },
169 "labelsSeparateLines": {
170 "default": "false",
171 "labels": ["Legend"],
172 "type": "boolean",
173 "description": "Put <code>&lt;br/&gt;</code> between lines in the label string. Often used in conjunction with <strong>labelsDiv</strong>."
174 },
175 "xValueFormatter": {
48e614ac
DV
176 "default": "",
177 "labels": ["Deprecated"],
178 "type": "",
179 "description": "Prefer axes: { x: { valueFormatter } }"
180 },
181 "valueFormatter": {
182 "default": "Depends on the type of your data.",
183 "labels": ["Legend", "Value display/formatting"],
184 "type": "function(num or millis, opts, dygraph)",
185 "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. For date axes, you can call new Date(millis) to get a Date object. opts is a function you can call to access various options (e.g. opts('labelsKMB'))."
74a5af31
DV
186 },
187 "pixelsPerYLabel": {
48e614ac
DV
188 "default": "",
189 "labels": ["Deprecated"],
74a5af31 190 "type": "integer",
48e614ac 191 "description": "Prefer axes: { y: { pixelsPerLabel } }"
74a5af31
DV
192 },
193 "annotationMouseOverHandler": {
194 "default": "null",
195 "labels": ["Annotations"],
196 "type": "function(annotation, point, dygraph, event)",
197 "description": "If provided, this function is called whenever the user mouses over an annotation."
198 },
199 "annotationMouseOutHandler": {
200 "default": "null",
201 "labels": ["Annotations"],
202 "type": "function(annotation, point, dygraph, event)",
b5bdd85b
RK
203 "parameters": [
204 [ "annotation" , "the annotation left" ],
205 [ "point" , "the point associated with the annotation" ],
206 [ "dygraph" , "the reference graph" ],
207 [ "event" , "the mouse event" ]
208 ],
74a5af31
DV
209 "description": "If provided, this function is called whenever the user mouses out of an annotation."
210 },
211 "annotationClickHandler": {
212 "default": "null",
213 "labels": ["Annotations"],
214 "type": "function(annotation, point, dygraph, event)",
b5bdd85b
RK
215 "parameters": [
216 [ "annotation" , "the annotation left" ],
217 [ "point" , "the point associated with the annotation" ],
218 [ "dygraph" , "the reference graph" ],
219 [ "event" , "the mouse event" ]
220 ],
74a5af31
DV
221 "description": "If provided, this function is called whenever the user clicks on an annotation."
222 },
223 "annotationDblClickHandler": {
224 "default": "null",
225 "labels": ["Annotations"],
226 "type": "function(annotation, point, dygraph, event)",
b5bdd85b
RK
227 "parameters": [
228 [ "annotation" , "the annotation left" ],
229 [ "point" , "the point associated with the annotation" ],
230 [ "dygraph" , "the reference graph" ],
231 [ "event" , "the mouse event" ]
232 ],
74a5af31
DV
233 "description": "If provided, this function is called whenever the user double-clicks on an annotation."
234 },
235 "drawCallback": {
236 "default": "null",
237 "labels": ["Callbacks"],
238 "type": "function(dygraph, is_initial)",
b5bdd85b
RK
239 "parameters": [
240 [ "dygraph" , "The graph being drawn" ],
241 [ "is_initial" , "True if this is the initial draw, false for subsequent draws." ]
242 ],
243 "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
244 },
245 "labelsKMG2": {
246 "default": "false",
247 "labels": ["Value display/formatting"],
248 "type": "boolean",
249 "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."
250 },
251 "delimiter": {
252 "default": ",",
253 "labels": ["CSV parsing"],
254 "type": "string",
255 "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."
256 },
257 "axisLabelFontSize": {
258 "default": "14",
259 "labels": ["Axis display"],
260 "type": "integer",
261 "description": "Size of the font (in pixels) to use in the axis labels, both x- and y-axis."
262 },
263 "underlayCallback": {
264 "default": "null",
265 "labels": ["Callbacks"],
266 "type": "function(canvas, area, dygraph)",
b5bdd85b
RK
267 "parameters": [
268 [ "canvas" , "the canvas to draw on" ],
269 [ "area" , "" ],
270 [ "dygraph" , "the reference graph" ]
271 ],
74a5af31
DV
272 "description": "When set, this callback gets called before the chart is drawn. It details on how to use this."
273 },
274 "width": {
275 "default": "480",
276 "labels": ["Overall display"],
277 "type": "integer",
278 "description": "Width, in pixels, of the chart. If the container div has been explicitly sized, this will be ignored."
279 },
280 "interactionModel": {
281 "default": "...",
282 "labels": ["Interactive Elements"],
283 "type": "Object",
284 "description": "TODO(konigsberg): document this"
285 },
758a629f 286 "ticker": {
74a5af31
DV
287 "default": "Dygraph.dateTicker or Dygraph.numericTicks",
288 "labels": ["Axis display"],
48e614ac 289 "type": "function(min, max, pixels, opts, dygraph, vals) -> [{v: ..., label: ...}, ...]",
b5bdd85b
RK
290 "parameters": [
291 [ "min" , "" ],
292 [ "max" , "" ],
293 [ "pixels" , "" ],
294 [ "opts" , "" ],
295 [ "dygraph" , "the reference graph" ],
296 [ "vals" , "" ]
297 ],
758a629f 298 "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
DV
299 },
300 "xAxisLabelWidth": {
301 "default": "50",
302 "labels": ["Axis display"],
303 "type": "integer",
304 "description": "Width, in pixels, of the x-axis labels."
305 },
306 "xAxisHeight": {
307 "default": "(null)",
308 "labels": ["Axis display"],
309 "type": "integer",
310 "description": "Height, in pixels, of the x-axis. If not set explicitly, this is computed based on axisLabelFontSize and axisTickSize."
311 },
312 "showLabelsOnHighlight": {
313 "default": "true",
314 "labels": ["Interactive Elements", "Legend"],
315 "type": "boolean",
316 "description": "Whether to show the legend upon mouseover."
317 },
318 "axis": {
319 "default": "(none)",
320 "labels": ["Axis display"],
321 "type": "string or object",
322 "description": "Set to either an object ({}) filled with options for this axis or to the name of an existing data series with its own axis to re-use that axis. See tests for usage."
323 },
324 "pixelsPerXLabel": {
48e614ac
DV
325 "default": "",
326 "labels": ["Deprecated"],
327 "type": "integer",
328 "description": "Prefer axes { x: { pixelsPerLabel } }"
329 },
330 "pixelsPerLabel": {
331 "default": "60 (x-axis) or 30 (y-axes)",
74a5af31
DV
332 "labels": ["Axis display", "Grid"],
333 "type": "integer",
48e614ac 334 "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
335 },
336 "labelsDiv": {
337 "default": "null",
338 "labels": ["Legend"],
339 "type": "DOM element or string",
340 "example": "<code style='font-size: small'>document.getElementById('foo')</code>or<code>'foo'",
341 "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."
342 },
343 "fractions": {
344 "default": "false",
345 "labels": ["CSV parsing", "Error Bars"],
346 "type": "boolean",
347 "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)."
348 },
349 "logscale": {
350 "default": "false",
351 "labels": ["Axis display"],
352 "type": "boolean",
353 "description": "When set for a y-axis, the graph shows that axis in log scale. Any values less than or equal to zero are not displayed.\n\nNot compatible with showZero, and ignores connectSeparatedPoints. Also, showing log scale with valueRanges that are less than zero will result in an unviewable graph."
354 },
355 "strokeWidth": {
356 "default": "1.0",
357 "labels": ["Data Line display"],
475f7420 358 "type": "float",
74a5af31
DV
359 "example": "0.5, 2.0",
360 "description": "The width of the lines connecting data points. This can be used to increase the contrast or some graphs."
361 },
79253bd0 362 "strokePattern": {
363 "default": "null",
364 "labels": ["Data Line display"],
365 "type": "array<integer>",
366 "example": "[10, 2, 5, 2]",
e2c21500 367 "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 368 },
857a6931
KW
369 "strokeBorderWidth": {
370 "default": "null",
371 "labels": ["Data Line display"],
475f7420
KW
372 "type": "float",
373 "example": "1.0",
857a6931
KW
374 "description": "Draw a border around graph lines to make crossing lines more easily distinguishable. Useful for graphs with many lines."
375 },
376 "strokeBorderColor": {
377 "default": "white",
378 "labels": ["Data Line display"],
379 "type": "string",
380 "example": "red, #ccffdd",
381 "description": "Color for the line border used if strokeBorderWidth is set."
382 },
74a5af31
DV
383 "wilsonInterval": {
384 "default": "true",
385 "labels": ["Error Bars"],
386 "type": "boolean",
387 "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."
388 },
389 "fillGraph": {
390 "default": "false",
391 "labels": ["Data Line display"],
392 "type": "boolean",
393 "description": "Should the area underneath the graph be filled? This option is not compatible with error bars."
394 },
395 "highlightCircleSize": {
396 "default": "3",
397 "labels": ["Interactive Elements"],
398 "type": "integer",
399 "description": "The size in pixels of the dot drawn over highlighted points."
400 },
401 "gridLineColor": {
402 "default": "rgb(128,128,128)",
403 "labels": ["Grid"],
404 "type": "red, blue",
405 "description": "The color of the gridlines."
406 },
407 "visibility": {
408 "default": "[true, true, ...]",
409 "labels": ["Data Line display"],
410 "type": "Array of booleans",
411 "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."
412 },
413 "valueRange": {
414 "default": "Full range of the input is shown",
415 "labels": ["Axis display"],
416 "type": "Array of two numbers",
417 "example": "[10, 110]",
4dd0ac55 418 "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."
74a5af31
DV
419 },
420 "labelsDivWidth": {
421 "default": "250",
422 "labels": ["Legend"],
423 "type": "integer",
424 "description": "Width (in pixels) of the div which shows information on the currently-highlighted points."
425 },
426 "colorSaturation": {
427 "default": "1.0",
428 "labels": ["Data Series Colors"],
429 "type": "float (0.0 - 1.0)",
430 "description": "If <strong>colors</strong> is not specified, saturation of the automatically-generated data series colors."
431 },
432 "yAxisLabelWidth": {
433 "default": "50",
434 "labels": ["Axis display"],
435 "type": "integer",
436 "description": "Width, in pixels, of the y-axis labels. This also affects the amount of space available for a y-axis chart label."
437 },
438 "hideOverlayOnMouseOut": {
439 "default": "true",
440 "labels": ["Interactive Elements", "Legend"],
441 "type": "boolean",
442 "description": "Whether to hide the legend when the mouse leaves the chart area."
443 },
444 "yValueFormatter": {
48e614ac
DV
445 "default": "",
446 "labels": ["Deprecated"],
447 "type": "",
448 "description": "Prefer axes: { y: { valueFormatter } }"
74a5af31
DV
449 },
450 "legend": {
451 "default": "onmouseover",
452 "labels": ["Legend"],
453 "type": "string",
454 "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."
455 },
456 "labelsShowZeroValues": {
457 "default": "true",
458 "labels": ["Legend"],
459 "type": "boolean",
460 "description": "Show zero value labels in the labelsDiv."
461 },
462 "stepPlot": {
463 "default": "false",
464 "labels": ["Data Line display"],
465 "type": "boolean",
466 "description": "When set, display the graph as a step plot instead of a line plot."
467 },
468 "labelsKMB": {
469 "default": "false",
470 "labels": ["Value display/formatting"],
471 "type": "boolean",
472 "description": "Show K/M/B for thousands/millions/billions on y-axis."
473 },
474 "rightGap": {
475 "default": "5",
476 "labels": ["Overall display"],
477 "type": "integer",
478 "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."
479 },
480 "avoidMinZero": {
481 "default": "false",
482 "labels": ["Axis display"],
483 "type": "boolean",
484 "description": "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."
485 },
486 "xAxisLabelFormatter": {
48e614ac
DV
487 "default": "",
488 "labels": ["Deprecated"],
489 "type": "",
490 "description": "Prefer axes { x: { axisLabelFormatter } }"
491 },
492 "axisLabelFormatter": {
493 "default": "Depends on the data type",
494 "labels": ["Axis display"],
495 "type": "function(number or Date, granularity, opts, dygraph)",
b5bdd85b
RK
496 "parameters": [
497 [ "number or date" , "Either a number (for a numeric axis) or a Date object (for a date axis)" ],
498 [ "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." ],
499 [ "opts" , "a function which provides access to various options on the dygraph, e.g. opts('labelsKMB')." ],
500 [ "dygraph" , "the referenced graph" ]
501 ],
502 "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
503 },
504 "clickCallback": {
e6e12f18 505 "snippet": "function(e, date_millis){<br>&nbsp;&nbsp;alert(new Date(date_millis));<br>}",
74a5af31
DV
506 "default": "null",
507 "labels": ["Callbacks"],
e6e12f18 508 "type": "function(e, x, points)",
b5bdd85b
RK
509 "parameters": [
510 [ "e" , "The event object for the click" ],
511 [ "x" , "The x value that was clicked (for dates, this is milliseconds since epoch)" ],
512 [ "points" , "The closest points along that date. See <a href='#point_properties'>Point properties</a> for details." ]
513 ],
514 "description": "A function to call when the canvas is clicked."
74a5af31
DV
515 },
516 "yAxisLabelFormatter": {
48e614ac
DV
517 "default": "",
518 "labels": ["Deprecated"],
519 "type": "",
520 "description": "Prefer axes: { y: { axisLabelFormatter } }"
74a5af31
DV
521 },
522 "labels": {
523 "default": "[\"X\", \"Y1\", \"Y2\", ...]*",
524 "labels": ["Legend"],
525 "type": "array<string>",
526 "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."
527 },
528 "dateWindow": {
529 "default": "Full range of the input is shown",
530 "labels": ["Axis display"],
531 "type": "Array of two Dates or numbers",
532 "example": "[<br>&nbsp;&nbsp;Date.parse('2006-01-01'),<br>&nbsp;&nbsp;(new Date()).valueOf()<br>]",
533 "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."
534 },
535 "showRoller": {
536 "default": "false",
537 "labels": ["Interactive Elements", "Rolling Averages"],
538 "type": "boolean",
539 "description": "If the rolling average period text box should be shown."
540 },
541 "sigma": {
542 "default": "2.0",
543 "labels": ["Error Bars"],
544 "type": "float",
545 "description": "When errorBars is set, shade this many standard deviations above/below each point."
546 },
547 "customBars": {
548 "default": "false",
549 "labels": ["CSV parsing", "Error Bars"],
550 "type": "boolean",
551 "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."
552 },
553 "colorValue": {
554 "default": "1.0",
555 "labels": ["Data Series Colors"],
556 "type": "float (0.0 - 1.0)",
557 "description": "If colors is not specified, value of the data series colors, as in hue/saturation/value. (0.0-1.0, default 0.5)"
558 },
559 "errorBars": {
560 "default": "false",
561 "labels": ["CSV parsing", "Error Bars"],
562 "type": "boolean",
563 "description": "Does the data contain standard deviations? Setting this to true alters the input format (see above)."
564 },
565 "displayAnnotations": {
566 "default": "false",
567 "labels": ["Annotations"],
568 "type": "boolean",
569 "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."
570 },
571 "panEdgeFraction": {
572 "default": "null",
573 "labels": ["Axis display", "Interactive Elements"],
574 "type": "float",
74a5af31
DV
575 "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."
576 },
577 "title": {
578 "labels": ["Chart labels"],
579 "type": "string",
580 "default": "null",
581 "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."
582 },
583 "titleHeight": {
584 "default": "18",
585 "labels": ["Chart labels"],
586 "type": "integer",
587 "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."
588 },
589 "xlabel": {
590 "labels": ["Chart labels"],
591 "type": "string",
592 "default": "null",
593 "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."
594 },
595 "xLabelHeight": {
596 "labels": ["Chart labels"],
597 "type": "integer",
598 "default": "18",
599 "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."
600 },
601 "ylabel": {
602 "labels": ["Chart labels"],
603 "type": "string",
604 "default": "null",
605 "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."
606 },
d0c39108
DV
607 "y2label": {
608 "labels": ["Chart labels"],
609 "type": "string",
610 "default": "null",
611 "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."
612 },
74a5af31
DV
613 "yLabelWidth": {
614 "labels": ["Chart labels"],
615 "type": "integer",
616 "default": "18",
617 "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."
618 },
619 "isZoomedIgnoreProgrammaticZoom" : {
620 "default": "false",
621 "labels": ["Zooming"],
622 "type": "boolean",
623 "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."
624 },
625 "drawXGrid": {
626 "default": "true",
627 "labels": ["Grid"],
628 "type": "boolean",
629 "description" : "Whether to display vertical gridlines under the chart."
630 },
631 "drawYGrid": {
632 "default": "true",
633 "labels": ["Grid"],
634 "type": "boolean",
635 "description" : "Whether to display horizontal gridlines under the chart."
636 },
637 "drawXAxis": {
638 "default": "true",
639 "labels": ["Axis display"],
640 "type": "boolean",
641 "description" : "Whether to draw the x-axis. Setting this to false also prevents x-axis ticks from being drawn and reclaims the space for the chart grid/lines."
642 },
643 "drawYAxis": {
644 "default": "true",
645 "labels": ["Axis display"],
646 "type": "boolean",
647 "description" : "Whether to draw the y-axis. Setting this to false also prevents y-axis ticks from being drawn and reclaims the space for the chart grid/lines."
648 },
649 "gridLineWidth": {
650 "default": "0.3",
651 "labels": ["Grid"],
652 "type": "float",
653 "description" : "Thickness (in pixels) of the gridlines drawn under the chart. The vertical/horizontal gridlines can be turned off entirely by using the drawXGrid and drawYGrid options."
654 },
655 "axisLineWidth": {
656 "default": "0.3",
657 "labels": ["Axis display"],
658 "type": "float",
659 "description" : "Thickness (in pixels) of the x- and y-axis lines."
660 },
661 "axisLineColor": {
662 "default": "black",
663 "labels": ["Axis display"],
664 "type": "string",
665 "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)'."
666 },
667 "fillAlpha": {
668 "default": "0.15",
669 "labels": ["Error Bars", "Data Series Colors"],
670 "type": "float (0.0 - 1.0)",
671 "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."
672 },
673 "axisLabelColor": {
674 "default": "black",
675 "labels": ["Axis display"],
676 "type": "string",
677 "description" : "Color for x- and y-axis labels. This is a CSS color string."
678 },
679 "axisLabelWidth": {
680 "default": "50",
681 "labels": ["Axis display", "Chart labels"],
682 "type": "integer",
683 "description" : "Width (in pixels) of the containing divs for x- and y-axis labels. For the y-axis, this also controls "
684 },
685 "sigFigs" : {
686 "default": "null",
687 "labels": ["Value display/formatting"],
688 "type": "integer",
689 "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."
690 },
691 "digitsAfterDecimal" : {
692 "default": "2",
693 "labels": ["Value display/formatting"],
694 "type": "integer",
695 "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."
696 },
697 "maxNumberWidth" : {
698 "default": "6",
699 "labels": ["Value display/formatting"],
700 "type": "integer",
701 "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."
702 },
703 "file": {
704 "default": "(set when constructed)",
705 "labels": ["Data"],
706 "type": "string (URL of CSV or CSV), GViz DataTable or 2D Array",
707 "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
708 },
709 "timingName": {
710 "default": "null",
711 "labels": [ "Debugging" ],
712 "type": "string",
713 "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
714 },
715 "showRangeSelector": {
716 "default": "false",
717 "labels": ["Interactive Elements"],
718 "type": "boolean",
719 "description": "Show the range selector widget. This option can only be specified at Dygraph creation time."
720 },
721 "rangeSelectorHeight": {
722 "default": "40",
723 "labels": ["Interactive Elements"],
724 "type": "integer",
725 "description": "Height, in pixels, of the range selector widget. This option can only be specified at Dygraph creation time."
726 },
727 "rangeSelectorPlotStrokeColor": {
728 "default": "#808FAB",
729 "labels": ["Interactive Elements"],
730 "type": "string",
731 "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."
732 },
733 "rangeSelectorPlotFillColor": {
734 "default": "#A7B1C4",
735 "labels": ["Interactive Elements"],
736 "type": "string",
737 "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
DV
738 },
739 "animatedZooms": {
740 "default": "false",
741 "labels": ["Interactive Elements"],
742 "type": "boolean",
743 "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."
74a5af31
DV
744 }
745}
746; // </JSON>
747// NOTE: in addition to parsing as JS, this snippet is expected to be valid
748// JSON. This assumption cannot be checked in JS, but it will be checked when
749// documentation is generated by the generate-documentation.py script. For the
750// most part, this just means that you should always use double quotes.
751
752// Do a quick sanity check on the options reference.
753(function() {
758a629f 754 "use strict";
74a5af31
DV
755 var warn = function(msg) { if (console) console.warn(msg); };
756 var flds = ['type', 'default', 'description'];
ccd9d7c2 757 var valid_cats = [
74a5af31
DV
758 'Annotations',
759 'Axis display',
760 'Chart labels',
761 'CSV parsing',
762 'Callbacks',
763 'Data',
764 'Data Line display',
765 'Data Series Colors',
766 'Error Bars',
767 'Grid',
768 'Interactive Elements',
769 'Legend',
770 'Overall display',
771 'Rolling Averages',
772 'Value display/formatting',
7153e001 773 'Zooming',
48e614ac
DV
774 'Debugging',
775 'Deprecated'
74a5af31 776 ];
758a629f 777 var i;
74a5af31 778 var cats = {};
758a629f 779 for (i = 0; i < valid_cats.length; i++) cats[valid_cats[i]] = true;
74a5af31
DV
780
781 for (var k in Dygraph.OPTIONS_REFERENCE) {
782 if (!Dygraph.OPTIONS_REFERENCE.hasOwnProperty(k)) continue;
783 var op = Dygraph.OPTIONS_REFERENCE[k];
758a629f 784 for (i = 0; i < flds.length; i++) {
74a5af31
DV
785 if (!op.hasOwnProperty(flds[i])) {
786 warn('Option ' + k + ' missing "' + flds[i] + '" property');
787 } else if (typeof(op[flds[i]]) != 'string') {
788 warn(k + '.' + flds[i] + ' must be of type string');
789 }
790 }
758a629f 791 var labels = op.labels;
74a5af31
DV
792 if (typeof(labels) !== 'object') {
793 warn('Option "' + k + '" is missing a "labels": [...] option');
794 } else {
758a629f 795 for (i = 0; i < labels.length; i++) {
74a5af31
DV
796 if (!cats.hasOwnProperty(labels[i])) {
797 warn('Option "' + k + '" has label "' + labels[i] +
798 '", which is invalid.');
799 }
800 }
801 }
802 }
803})();