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