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