Delete multiple_axes-old properly. Keep it dead, dead, dead.
[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
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 ],
47e07d08 86 "description": "A function to call when the zoom window is changed (either by zooming in or out)."
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"],
196 "type": "function(num or millis, opts, dygraph)",
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. 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 198 },
74a5af31
DV
199 "annotationMouseOverHandler": {
200 "default": "null",
201 "labels": ["Annotations"],
202 "type": "function(annotation, point, dygraph, event)",
203 "description": "If provided, this function is called whenever the user mouses over an annotation."
204 },
205 "annotationMouseOutHandler": {
206 "default": "null",
207 "labels": ["Annotations"],
208 "type": "function(annotation, point, dygraph, event)",
b5bdd85b
RK
209 "parameters": [
210 [ "annotation" , "the annotation left" ],
211 [ "point" , "the point associated with the annotation" ],
212 [ "dygraph" , "the reference graph" ],
213 [ "event" , "the mouse event" ]
214 ],
74a5af31
DV
215 "description": "If provided, this function is called whenever the user mouses out of an annotation."
216 },
217 "annotationClickHandler": {
218 "default": "null",
219 "labels": ["Annotations"],
220 "type": "function(annotation, point, dygraph, event)",
b5bdd85b
RK
221 "parameters": [
222 [ "annotation" , "the annotation left" ],
223 [ "point" , "the point associated with the annotation" ],
224 [ "dygraph" , "the reference graph" ],
225 [ "event" , "the mouse event" ]
226 ],
74a5af31
DV
227 "description": "If provided, this function is called whenever the user clicks on an annotation."
228 },
229 "annotationDblClickHandler": {
230 "default": "null",
231 "labels": ["Annotations"],
232 "type": "function(annotation, point, dygraph, event)",
b5bdd85b
RK
233 "parameters": [
234 [ "annotation" , "the annotation left" ],
235 [ "point" , "the point associated with the annotation" ],
236 [ "dygraph" , "the reference graph" ],
237 [ "event" , "the mouse event" ]
238 ],
74a5af31
DV
239 "description": "If provided, this function is called whenever the user double-clicks on an annotation."
240 },
241 "drawCallback": {
242 "default": "null",
243 "labels": ["Callbacks"],
244 "type": "function(dygraph, is_initial)",
b5bdd85b
RK
245 "parameters": [
246 [ "dygraph" , "The graph being drawn" ],
247 [ "is_initial" , "True if this is the initial draw, false for subsequent draws." ]
248 ],
249 "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
250 },
251 "labelsKMG2": {
252 "default": "false",
253 "labels": ["Value display/formatting"],
254 "type": "boolean",
255 "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."
256 },
257 "delimiter": {
258 "default": ",",
259 "labels": ["CSV parsing"],
260 "type": "string",
261 "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."
262 },
263 "axisLabelFontSize": {
264 "default": "14",
265 "labels": ["Axis display"],
266 "type": "integer",
267 "description": "Size of the font (in pixels) to use in the axis labels, both x- and y-axis."
268 },
269 "underlayCallback": {
270 "default": "null",
271 "labels": ["Callbacks"],
1987a3df 272 "type": "function(context, area, dygraph)",
b5bdd85b 273 "parameters": [
1987a3df
DV
274 [ "context" , "the canvas drawing context on which to draw" ],
275 [ "area" , "An object with {x,y,w,h} properties describing the drawing area." ],
b5bdd85b
RK
276 [ "dygraph" , "the reference graph" ]
277 ],
74a5af31
DV
278 "description": "When set, this callback gets called before the chart is drawn. It details on how to use this."
279 },
280 "width": {
281 "default": "480",
282 "labels": ["Overall display"],
283 "type": "integer",
284 "description": "Width, in pixels, of the chart. If the container div has been explicitly sized, this will be ignored."
285 },
286 "interactionModel": {
287 "default": "...",
288 "labels": ["Interactive Elements"],
289 "type": "Object",
290 "description": "TODO(konigsberg): document this"
291 },
758a629f 292 "ticker": {
74a5af31
DV
293 "default": "Dygraph.dateTicker or Dygraph.numericTicks",
294 "labels": ["Axis display"],
48e614ac 295 "type": "function(min, max, pixels, opts, dygraph, vals) -> [{v: ..., label: ...}, ...]",
b5bdd85b
RK
296 "parameters": [
297 [ "min" , "" ],
298 [ "max" , "" ],
299 [ "pixels" , "" ],
300 [ "opts" , "" ],
301 [ "dygraph" , "the reference graph" ],
302 [ "vals" , "" ]
303 ],
758a629f 304 "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 305 },
74a5af31
DV
306 "xAxisHeight": {
307 "default": "(null)",
308 "labels": ["Axis display"],
309 "type": "integer",
310 "description": "Height, in pixels, of the x-axis. If not set explicitly, this is computed based on axisLabelFontSize and axisTickSize."
311 },
312 "showLabelsOnHighlight": {
313 "default": "true",
314 "labels": ["Interactive Elements", "Legend"],
315 "type": "boolean",
316 "description": "Whether to show the legend upon mouseover."
317 },
318 "axis": {
319 "default": "(none)",
320 "labels": ["Axis display"],
8498e5e8
DV
321 "type": "string",
322 "description": "Set to either 'y1' or 'y2' to assign a series to a y-axis (primary or secondary). Must be set per-series."
74a5af31 323 },
48e614ac 324 "pixelsPerLabel": {
d8dd8c2b 325 "default": "70 (x-axis) or 30 (y-axes)",
74a5af31
DV
326 "labels": ["Axis display", "Grid"],
327 "type": "integer",
48e614ac 328 "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
329 },
330 "labelsDiv": {
331 "default": "null",
332 "labels": ["Legend"],
333 "type": "DOM element or string",
334 "example": "<code style='font-size: small'>document.getElementById('foo')</code>or<code>'foo'",
335 "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."
336 },
337 "fractions": {
338 "default": "false",
339 "labels": ["CSV parsing", "Error Bars"],
340 "type": "boolean",
341 "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)."
342 },
343 "logscale": {
344 "default": "false",
345 "labels": ["Axis display"],
346 "type": "boolean",
5b9b2142 347 "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
348 },
349 "strokeWidth": {
350 "default": "1.0",
351 "labels": ["Data Line display"],
475f7420 352 "type": "float",
74a5af31
DV
353 "example": "0.5, 2.0",
354 "description": "The width of the lines connecting data points. This can be used to increase the contrast or some graphs."
355 },
79253bd0 356 "strokePattern": {
357 "default": "null",
358 "labels": ["Data Line display"],
359 "type": "array<integer>",
360 "example": "[10, 2, 5, 2]",
e2c21500 361 "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 362 },
857a6931
KW
363 "strokeBorderWidth": {
364 "default": "null",
365 "labels": ["Data Line display"],
475f7420
KW
366 "type": "float",
367 "example": "1.0",
857a6931
KW
368 "description": "Draw a border around graph lines to make crossing lines more easily distinguishable. Useful for graphs with many lines."
369 },
370 "strokeBorderColor": {
371 "default": "white",
372 "labels": ["Data Line display"],
373 "type": "string",
374 "example": "red, #ccffdd",
375 "description": "Color for the line border used if strokeBorderWidth is set."
376 },
74a5af31
DV
377 "wilsonInterval": {
378 "default": "true",
379 "labels": ["Error Bars"],
380 "type": "boolean",
381 "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."
382 },
383 "fillGraph": {
384 "default": "false",
385 "labels": ["Data Line display"],
386 "type": "boolean",
cf8c87d4 387 "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
388 },
389 "highlightCircleSize": {
390 "default": "3",
391 "labels": ["Interactive Elements"],
392 "type": "integer",
393 "description": "The size in pixels of the dot drawn over highlighted points."
394 },
395 "gridLineColor": {
396 "default": "rgb(128,128,128)",
397 "labels": ["Grid"],
398 "type": "red, blue",
86e9b1eb 399 "description": "The color of the gridlines. This may be set on a per-axis basis to define each axis' grid separately."
74a5af31 400 },
8887663f
DV
401 "gridLinePattern": {
402 "default": "null",
403 "labels": ["Grid"],
404 "type": "array<integer>",
405 "example": "[10, 2, 5, 2]",
406 "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."
407 },
74a5af31
DV
408 "visibility": {
409 "default": "[true, true, ...]",
410 "labels": ["Data Line display"],
411 "type": "Array of booleans",
412 "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."
413 },
414 "valueRange": {
415 "default": "Full range of the input is shown",
416 "labels": ["Axis display"],
417 "type": "Array of two numbers",
418 "example": "[10, 110]",
1e1233b3 419 "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
420 },
421 "labelsDivWidth": {
422 "default": "250",
423 "labels": ["Legend"],
424 "type": "integer",
425 "description": "Width (in pixels) of the div which shows information on the currently-highlighted points."
426 },
427 "colorSaturation": {
428 "default": "1.0",
429 "labels": ["Data Series Colors"],
430 "type": "float (0.0 - 1.0)",
431 "description": "If <strong>colors</strong> is not specified, saturation of the automatically-generated data series colors."
432 },
74a5af31
DV
433 "hideOverlayOnMouseOut": {
434 "default": "true",
435 "labels": ["Interactive Elements", "Legend"],
436 "type": "boolean",
437 "description": "Whether to hide the legend when the mouse leaves the chart area."
438 },
74a5af31
DV
439 "legend": {
440 "default": "onmouseover",
441 "labels": ["Legend"],
442 "type": "string",
a22cc809 443 "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
444 },
445 "labelsShowZeroValues": {
446 "default": "true",
447 "labels": ["Legend"],
448 "type": "boolean",
449 "description": "Show zero value labels in the labelsDiv."
450 },
451 "stepPlot": {
452 "default": "false",
453 "labels": ["Data Line display"],
454 "type": "boolean",
104d87c5 455 "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 456 },
8c0599e3 457 "labelsUTC": {
872a6a00 458 "default": "false",
8c0599e3 459 "labels": ["Value display/formatting", "Axis display"],
872a6a00
DV
460 "type": "boolean",
461 "description": "Show date/time labels according to UTC (instead of local time)."
462 },
74a5af31
DV
463 "labelsKMB": {
464 "default": "false",
465 "labels": ["Value display/formatting"],
466 "type": "boolean",
467 "description": "Show K/M/B for thousands/millions/billions on y-axis."
468 },
469 "rightGap": {
470 "default": "5",
471 "labels": ["Overall display"],
472 "type": "integer",
473 "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."
474 },
475 "avoidMinZero": {
476 "default": "false",
fa460473 477 "labels": ["Deprecated"],
74a5af31 478 "type": "boolean",
fa460473 479 "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 480 },
f4b87da2
KW
481 "drawAxesAtZero": {
482 "default": "false",
483 "labels": ["Axis display"],
484 "type": "boolean",
485 "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."
486 },
fa460473
KW
487 "xRangePad": {
488 "default": "0",
489 "labels": ["Axis display"],
490 "type": "float",
491 "description": "Add the specified amount of extra space (in pixels) around the X-axis value range to ensure points at the edges remain visible."
492 },
493 "yRangePad": {
494 "default": "null",
495 "labels": ["Axis display"],
496 "type": "float",
497 "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."
498 },
48e614ac
DV
499 "axisLabelFormatter": {
500 "default": "Depends on the data type",
501 "labels": ["Axis display"],
502 "type": "function(number or Date, granularity, opts, dygraph)",
b5bdd85b
RK
503 "parameters": [
504 [ "number or date" , "Either a number (for a numeric axis) or a Date object (for a date axis)" ],
505 [ "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." ],
506 [ "opts" , "a function which provides access to various options on the dygraph, e.g. opts('labelsKMB')." ],
507 [ "dygraph" , "the referenced graph" ]
508 ],
509 "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
510 },
511 "clickCallback": {
e6e12f18 512 "snippet": "function(e, date_millis){<br>&nbsp;&nbsp;alert(new Date(date_millis));<br>}",
74a5af31
DV
513 "default": "null",
514 "labels": ["Callbacks"],
e6e12f18 515 "type": "function(e, x, points)",
b5bdd85b
RK
516 "parameters": [
517 [ "e" , "The event object for the click" ],
518 [ "x" , "The x value that was clicked (for dates, this is milliseconds since epoch)" ],
519 [ "points" , "The closest points along that date. See <a href='#point_properties'>Point properties</a> for details." ]
520 ],
521 "description": "A function to call when the canvas is clicked."
74a5af31 522 },
74a5af31
DV
523 "labels": {
524 "default": "[\"X\", \"Y1\", \"Y2\", ...]*",
525 "labels": ["Legend"],
526 "type": "array<string>",
527 "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."
528 },
529 "dateWindow": {
530 "default": "Full range of the input is shown",
531 "labels": ["Axis display"],
b78c3349 532 "type": "Array of two numbers",
74a5af31
DV
533 "example": "[<br>&nbsp;&nbsp;Date.parse('2006-01-01'),<br>&nbsp;&nbsp;(new Date()).valueOf()<br>]",
534 "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."
535 },
536 "showRoller": {
537 "default": "false",
538 "labels": ["Interactive Elements", "Rolling Averages"],
539 "type": "boolean",
540 "description": "If the rolling average period text box should be shown."
541 },
542 "sigma": {
543 "default": "2.0",
544 "labels": ["Error Bars"],
545 "type": "float",
546 "description": "When errorBars is set, shade this many standard deviations above/below each point."
547 },
548 "customBars": {
549 "default": "false",
550 "labels": ["CSV parsing", "Error Bars"],
551 "type": "boolean",
552 "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."
553 },
554 "colorValue": {
555 "default": "1.0",
556 "labels": ["Data Series Colors"],
557 "type": "float (0.0 - 1.0)",
558 "description": "If colors is not specified, value of the data series colors, as in hue/saturation/value. (0.0-1.0, default 0.5)"
559 },
560 "errorBars": {
561 "default": "false",
562 "labels": ["CSV parsing", "Error Bars"],
563 "type": "boolean",
564 "description": "Does the data contain standard deviations? Setting this to true alters the input format (see above)."
565 },
566 "displayAnnotations": {
567 "default": "false",
568 "labels": ["Annotations"],
569 "type": "boolean",
570 "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."
571 },
572 "panEdgeFraction": {
573 "default": "null",
574 "labels": ["Axis display", "Interactive Elements"],
575 "type": "float",
74a5af31
DV
576 "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."
577 },
578 "title": {
579 "labels": ["Chart labels"],
580 "type": "string",
581 "default": "null",
582 "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."
583 },
584 "titleHeight": {
585 "default": "18",
586 "labels": ["Chart labels"],
587 "type": "integer",
588 "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."
589 },
590 "xlabel": {
591 "labels": ["Chart labels"],
592 "type": "string",
593 "default": "null",
594 "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."
595 },
596 "xLabelHeight": {
597 "labels": ["Chart labels"],
598 "type": "integer",
599 "default": "18",
600 "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."
601 },
602 "ylabel": {
603 "labels": ["Chart labels"],
604 "type": "string",
605 "default": "null",
606 "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."
607 },
d0c39108
DV
608 "y2label": {
609 "labels": ["Chart labels"],
610 "type": "string",
611 "default": "null",
612 "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."
613 },
74a5af31
DV
614 "yLabelWidth": {
615 "labels": ["Chart labels"],
616 "type": "integer",
617 "default": "18",
618 "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."
619 },
620 "isZoomedIgnoreProgrammaticZoom" : {
621 "default": "false",
622 "labels": ["Zooming"],
623 "type": "boolean",
624 "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."
625 },
86e9b1eb 626 "drawGrid": {
97adf46b
DE
627 "default": "true for x and y, false for y2",
628 "labels": ["Grid"],
629 "type": "boolean",
630 "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
631 },
632 "independentTicks": {
6c5f8774 633 "default": "true for y, false for y2",
97adf46b
DE
634 "labels": ["Axis display", "Grid"],
635 "type": "boolean",
6c5f8774 636 "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 637 },
7f6a7190
RK
638 "drawAxis": {
639 "default": "true for x and y, false for y2",
640 "labels": ["Axis display"],
641 "type": "boolean",
642 "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
643 },
644 "gridLineWidth": {
645 "default": "0.3",
646 "labels": ["Grid"],
647 "type": "float",
bfb3e0a4 648 "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
649 },
650 "axisLineWidth": {
651 "default": "0.3",
652 "labels": ["Axis display"],
653 "type": "float",
654 "description" : "Thickness (in pixels) of the x- and y-axis lines."
655 },
656 "axisLineColor": {
657 "default": "black",
658 "labels": ["Axis display"],
659 "type": "string",
660 "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)'."
661 },
662 "fillAlpha": {
663 "default": "0.15",
664 "labels": ["Error Bars", "Data Series Colors"],
665 "type": "float (0.0 - 1.0)",
666 "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."
667 },
668 "axisLabelColor": {
669 "default": "black",
670 "labels": ["Axis display"],
671 "type": "string",
672 "description" : "Color for x- and y-axis labels. This is a CSS color string."
673 },
674 "axisLabelWidth": {
d8dd8c2b 675 "default": "50 (y-axis), 60 (x-axis)",
74a5af31
DV
676 "labels": ["Axis display", "Chart labels"],
677 "type": "integer",
d8dd8c2b 678 "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
679 },
680 "sigFigs" : {
681 "default": "null",
682 "labels": ["Value display/formatting"],
683 "type": "integer",
684 "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."
685 },
686 "digitsAfterDecimal" : {
687 "default": "2",
688 "labels": ["Value display/formatting"],
689 "type": "integer",
690 "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."
691 },
692 "maxNumberWidth" : {
693 "default": "6",
694 "labels": ["Value display/formatting"],
695 "type": "integer",
696 "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."
697 },
698 "file": {
699 "default": "(set when constructed)",
700 "labels": ["Data"],
701 "type": "string (URL of CSV or CSV), GViz DataTable or 2D Array",
702 "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
703 },
704 "timingName": {
705 "default": "null",
706 "labels": [ "Debugging" ],
707 "type": "string",
708 "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
709 },
710 "showRangeSelector": {
711 "default": "false",
712 "labels": ["Interactive Elements"],
713 "type": "boolean",
0d216a60 714 "description": "Show or hide the range selector widget."
ccd9d7c2
PF
715 },
716 "rangeSelectorHeight": {
717 "default": "40",
718 "labels": ["Interactive Elements"],
719 "type": "integer",
720 "description": "Height, in pixels, of the range selector widget. This option can only be specified at Dygraph creation time."
721 },
722 "rangeSelectorPlotStrokeColor": {
723 "default": "#808FAB",
724 "labels": ["Interactive Elements"],
725 "type": "string",
726 "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."
727 },
728 "rangeSelectorPlotFillColor": {
729 "default": "#A7B1C4",
730 "labels": ["Interactive Elements"],
731 "type": "string",
732 "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 733 },
0a0885d1 734 "showInRangeSelector": {
1085dbce
PP
735 "default": "null",
736 "labels": ["Interactive Elements"],
0a0885d1
DV
737 "type": "boolean",
738 "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 739 },
b1a3b195
DV
740 "animatedZooms": {
741 "default": "false",
742 "labels": ["Interactive Elements"],
743 "type": "boolean",
744 "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
745 },
746 "plotter": {
747 "default": "[DygraphCanvasRenderer.Plotters.fillPlotter, DygraphCanvasRenderer.Plotters.errorPlotter, DygraphCanvasRenderer.Plotters.linePlotter]",
748 "labels": ["Data Line display"],
749 "type": "array or function",
750 "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 751 },
8887663f
DV
752 "axes": {
753 "default": "null",
754 "labels": ["Configuration"],
755 "type": "Object",
756 "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>."
757 },
73e953cd
RK
758 "series": {
759 "default": "null",
760 "labels": ["Series"],
38f280e5 761 "type": "Object",
0a5aa490 762 "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
763 },
764 "plugins": {
765 "default": "[]",
766 "labels": ["Configuration"],
eced46cf 767 "type": "Array<plugin>",
3ea41d86
DV
768 "description": "Defines per-graph plugins. Useful for per-graph customization"
769 },
770 "dataHandler": {
771 "default": "(depends on data)",
772 "labels": ["Data"],
773 "type": "Dygraph.DataHandler",
774 "description": "Custom DataHandler. This is an advanced customization. See http://bit.ly/151E7Aq."
73e953cd 775 }
74a5af31
DV
776}
777; // </JSON>
778// NOTE: in addition to parsing as JS, this snippet is expected to be valid
779// JSON. This assumption cannot be checked in JS, but it will be checked when
780// documentation is generated by the generate-documentation.py script. For the
781// most part, this just means that you should always use double quotes.
782
783// Do a quick sanity check on the options reference.
784(function() {
758a629f 785 "use strict";
0bb99c82 786 var warn = function(msg) { if (window.console) window.console.warn(msg); };
74a5af31 787 var flds = ['type', 'default', 'description'];
ccd9d7c2 788 var valid_cats = [
74a5af31
DV
789 'Annotations',
790 'Axis display',
791 'Chart labels',
792 'CSV parsing',
793 'Callbacks',
794 'Data',
795 'Data Line display',
796 'Data Series Colors',
797 'Error Bars',
798 'Grid',
799 'Interactive Elements',
800 'Legend',
801 'Overall display',
802 'Rolling Averages',
6ca57c65 803 'Series',
74a5af31 804 'Value display/formatting',
7153e001 805 'Zooming',
48e614ac 806 'Debugging',
d9fbba56 807 'Configuration',
48e614ac 808 'Deprecated'
74a5af31 809 ];
758a629f 810 var i;
74a5af31 811 var cats = {};
758a629f 812 for (i = 0; i < valid_cats.length; i++) cats[valid_cats[i]] = true;
74a5af31
DV
813
814 for (var k in Dygraph.OPTIONS_REFERENCE) {
815 if (!Dygraph.OPTIONS_REFERENCE.hasOwnProperty(k)) continue;
816 var op = Dygraph.OPTIONS_REFERENCE[k];
758a629f 817 for (i = 0; i < flds.length; i++) {
74a5af31
DV
818 if (!op.hasOwnProperty(flds[i])) {
819 warn('Option ' + k + ' missing "' + flds[i] + '" property');
820 } else if (typeof(op[flds[i]]) != 'string') {
821 warn(k + '.' + flds[i] + ' must be of type string');
822 }
823 }
758a629f 824 var labels = op.labels;
74a5af31
DV
825 if (typeof(labels) !== 'object') {
826 warn('Option "' + k + '" is missing a "labels": [...] option');
827 } else {
758a629f 828 for (i = 0; i < labels.length; i++) {
74a5af31
DV
829 if (!cats.hasOwnProperty(labels[i])) {
830 warn('Option "' + k + '" has label "' + labels[i] +
831 '", which is invalid.');
832 }
833 }
834 }
835 }
836})();