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