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