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