Gallery code links reset the URL anchor. This fixes it.
[dygraphs.git] / dygraph-options-reference.js
... / ...
CommitLineData
1/**
2 * @license
3 * Copyright 2011 Dan Vanderkam (danvdk@gmail.com)
4 * MIT-licensed (http://opensource.org/licenses/MIT)
5 */
6
7/*jshint globalstrict: true */
8/*global Dygraph:false */
9
10// NOTE: in addition to parsing as JS, this snippet is expected to be valid
11// JSON. This assumption cannot be checked in JS, but it will be checked when
12// documentation is generated by the generate-documentation.py script. For the
13// most part, this just means that you should always use double quotes.
14Dygraph.OPTIONS_REFERENCE = // <JSON>
15{
16 "xValueParser": {
17 "default": "parseFloat() or Date.parse()*",
18 "labels": ["CSV parsing"],
19 "type": "function(str) -> number",
20 "description": "A function which parses x-values (i.e. the dependent series). Must return a number, even when the values are dates. In this case, millis since epoch are used. This is used primarily for parsing CSV data. *=Dygraphs is slightly more accepting in the dates which it will parse. See code for details."
21 },
22 "stackedGraph": {
23 "default": "false",
24 "labels": ["Data Line display"],
25 "type": "boolean",
26 "description": "If set, stack series on top of one another rather than drawing them independently."
27 },
28 "pointSize": {
29 "default": "1",
30 "labels": ["Data Line display"],
31 "type": "integer",
32 "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."
33 },
34 "labelsDivStyles": {
35 "default": "null",
36 "labels": ["Legend"],
37 "type": "{}",
38 "description": "Additional styles to apply to the currently-highlighted points div. For example, { 'font-weight': 'bold' } will make the labels bold."
39 },
40 "drawPoints": {
41 "default": "false",
42 "labels": ["Data Line display"],
43 "type": "boolean",
44 "description": "Draw a small dot at each point, in addition to a line going through \
45 the point. This makes the individual data points easier to see, but \
46 can increase visual clutter in the chart. The small dot can be \
47 replaced with a custom rendering by supplying a \
48 <a href='#drawPointCallback'>drawPointCallback</a>."
49 },
50 "drawPointCallback": {
51 "default": "null",
52 "labels": ["Data Line display"],
53 "type": "function(g, seriesName, canvasContext, cx, cy, color, pointSize)",
54 "parameters": [
55 [ "g" , "the reference graph" ],
56 [ "seriesName" , "the name of the series" ],
57 [ "canvasContext" , "the canvas to draw on" ],
58 [ "cx" , "center x coordinate" ],
59 [ "cy" , "center y coordinate" ],
60 [ "color" , "series color" ],
61 [ "pointSize" , "the radius of the image." ]
62 ],
63 "description": "Draw a custom item when drawPoints is enabled. \
64 Default is a small dot matching the series color. This method \
65 should constrain drawing to within pointSize pixels from (cx, cy). \
66 Also see <a href='#drawHighlightPointCallback'>drawHighlightPointCallback</a>"
67 },
68 "height": {
69 "default": "320",
70 "labels": ["Overall display"],
71 "type": "integer",
72 "description": "Height, in pixels, of the chart. If the container div has \
73 been explicitly sized, this will be ignored."
74 },
75 "zoomCallback": {
76 "default": "null",
77 "labels": ["Callbacks"],
78 "type": "function(minDate, maxDate, yRanges)",
79 "parameters": [
80 [ "minDate" , "milliseconds since epoch" ],
81 [ "maxDate" , "milliseconds since epoch." ],
82 [ "yRanges" , "is an array of [bottom, top] pairs, one for each y-axis." ]
83 ],
84 "description": "A function to call when the zoom window is changed (either \
85 by zooming in or out)."
86 },
87 "pointClickCallback": {
88 "snippet": "function(e, point){<br>&nbsp;&nbsp;alert(point);<br>}",
89 "default": "null",
90 "labels": ["Callbacks", "Interactive Elements"],
91 "type": "function(e, point)",
92 "parameters": [
93 [ "e" , "the event object for the click" ],
94 [ "point" , "the point that was clicked See <a href='#point_properties'>Point properties</a> for details" ]
95 ],
96 "description": "A function to call when a data point is clicked. and the point that was clicked."
97 },
98 "colors": {
99 "default": "(see description)",
100 "labels": ["Data Series Colors"],
101 "type": "array<string>",
102 "example": "['red', '#00FF00']",
103 "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."
104 },
105 "connectSeparatedPoints": {
106 "default": "false",
107 "labels": ["Data Line display"],
108 "type": "boolean",
109 "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."
110 },
111 "highlightCallback": {
112 "default": "null",
113 "labels": ["Callbacks"],
114 "type": "function(event, x, points, row)",
115 "description": "When set, this callback gets called every time a new point is highlighted.",
116 "parameters": [
117 ["event", "the JavaScript mousemove event"],
118 ["x", "the x-coordinate of the highlighted points"],
119 ["points", "an array of highlighted points: <code>[ {name: 'series', yval: y-value}, &hellip; ]</code>"],
120 ["row", "???"]
121 ]
122 },
123 "drawHighlightPointCallback": {
124 "default": "null",
125 "labels": ["Data Line display"],
126 "type": "function(g, seriesName, canvasContext, cx, cy, color, pointSize)",
127 "parameters": [
128 [ "g" , "the reference graph" ],
129 [ "seriesName" , "the name of the series" ],
130 [ "canvasContext" , "the canvas to draw on" ],
131 [ "cx" , "center x coordinate" ],
132 [ "cy" , "center y coordinate" ],
133 [ "color" , "series color" ],
134 [ "pointSize" , "the radius of the image." ]
135 ],
136 "description": "Draw a custom item when a point is highlighted. \
137 Default is a small dot matching the series color. This method \
138 should constrain drawing to within pointSize pixels from (cx, cy) \
139 Also see <a href='#drawPointCallback'>drawPointCallback</a>"
140 },
141 "includeZero": {
142 "default": "false",
143 "labels": ["Axis display"],
144 "type": "boolean",
145 "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"
146 },
147 "rollPeriod": {
148 "default": "1",
149 "labels": ["Error Bars", "Rolling Averages"],
150 "type": "integer &gt;= 1",
151 "description": "Number of days over which to average data. Discussed extensively above."
152 },
153 "unhighlightCallback": {
154 "default": "null",
155 "labels": ["Callbacks"],
156 "type": "function(event)",
157 "parameters": [
158 [ "event" , "the mouse event" ]
159 ],
160 "description": "When set, this callback gets called every time the user stops highlighting any point by mousing out of the graph."
161 },
162 "axisTickSize": {
163 "default": "3.0",
164 "labels": ["Axis display"],
165 "type": "number",
166 "description": "The size of the line to display next to each tick mark on x- or y-axes."
167 },
168 "labelsSeparateLines": {
169 "default": "false",
170 "labels": ["Legend"],
171 "type": "boolean",
172 "description": "Put <code>&lt;br/&gt;</code> between lines in the label string. Often used in conjunction with <strong>labelsDiv</strong>."
173 },
174 "xValueFormatter": {
175 "default": "",
176 "labels": ["Deprecated"],
177 "type": "",
178 "description": "Prefer axes: { x: { valueFormatter } }"
179 },
180 "valueFormatter": {
181 "default": "Depends on the type of your data.",
182 "labels": ["Legend", "Value display/formatting"],
183 "type": "function(num or millis, opts, dygraph)",
184 "description": "Function to provide a custom display format for the values displayed on mouseover. This does not affect the values that appear on tick marks next to the axes. To format those, see axisLabelFormatter. This is usually set on a <a href='per-axis.html'>per-axis</a> basis. For date axes, you can call new Date(millis) to get a Date object. opts is a function you can call to access various options (e.g. opts('labelsKMB'))."
185 },
186 "pixelsPerYLabel": {
187 "default": "",
188 "labels": ["Deprecated"],
189 "type": "integer",
190 "description": "Prefer axes: { y: { pixelsPerLabel } }"
191 },
192 "annotationMouseOverHandler": {
193 "default": "null",
194 "labels": ["Annotations"],
195 "type": "function(annotation, point, dygraph, event)",
196 "description": "If provided, this function is called whenever the user mouses over an annotation."
197 },
198 "annotationMouseOutHandler": {
199 "default": "null",
200 "labels": ["Annotations"],
201 "type": "function(annotation, point, dygraph, event)",
202 "parameters": [
203 [ "annotation" , "the annotation left" ],
204 [ "point" , "the point associated with the annotation" ],
205 [ "dygraph" , "the reference graph" ],
206 [ "event" , "the mouse event" ]
207 ],
208 "description": "If provided, this function is called whenever the user mouses out of an annotation."
209 },
210 "annotationClickHandler": {
211 "default": "null",
212 "labels": ["Annotations"],
213 "type": "function(annotation, point, dygraph, event)",
214 "parameters": [
215 [ "annotation" , "the annotation left" ],
216 [ "point" , "the point associated with the annotation" ],
217 [ "dygraph" , "the reference graph" ],
218 [ "event" , "the mouse event" ]
219 ],
220 "description": "If provided, this function is called whenever the user clicks on an annotation."
221 },
222 "annotationDblClickHandler": {
223 "default": "null",
224 "labels": ["Annotations"],
225 "type": "function(annotation, point, dygraph, event)",
226 "parameters": [
227 [ "annotation" , "the annotation left" ],
228 [ "point" , "the point associated with the annotation" ],
229 [ "dygraph" , "the reference graph" ],
230 [ "event" , "the mouse event" ]
231 ],
232 "description": "If provided, this function is called whenever the user double-clicks on an annotation."
233 },
234 "drawCallback": {
235 "default": "null",
236 "labels": ["Callbacks"],
237 "type": "function(dygraph, is_initial)",
238 "parameters": [
239 [ "dygraph" , "The graph being drawn" ],
240 [ "is_initial" , "True if this is the initial draw, false for subsequent draws." ]
241 ],
242 "description": "When set, this callback gets called every time the dygraph is drawn. This includes the initial draw, after zooming and repeatedly while panning."
243 },
244 "labelsKMG2": {
245 "default": "false",
246 "labels": ["Value display/formatting"],
247 "type": "boolean",
248 "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."
249 },
250 "delimiter": {
251 "default": ",",
252 "labels": ["CSV parsing"],
253 "type": "string",
254 "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."
255 },
256 "axisLabelFontSize": {
257 "default": "14",
258 "labels": ["Axis display"],
259 "type": "integer",
260 "description": "Size of the font (in pixels) to use in the axis labels, both x- and y-axis."
261 },
262 "underlayCallback": {
263 "default": "null",
264 "labels": ["Callbacks"],
265 "type": "function(canvas, area, dygraph)",
266 "parameters": [
267 [ "canvas" , "the canvas to draw on" ],
268 [ "area" , "" ],
269 [ "dygraph" , "the reference graph" ]
270 ],
271 "description": "When set, this callback gets called before the chart is drawn. It details on how to use this."
272 },
273 "width": {
274 "default": "480",
275 "labels": ["Overall display"],
276 "type": "integer",
277 "description": "Width, in pixels, of the chart. If the container div has been explicitly sized, this will be ignored."
278 },
279 "interactionModel": {
280 "default": "...",
281 "labels": ["Interactive Elements"],
282 "type": "Object",
283 "description": "TODO(konigsberg): document this"
284 },
285 "ticker": {
286 "default": "Dygraph.dateTicker or Dygraph.numericTicks",
287 "labels": ["Axis display"],
288 "type": "function(min, max, pixels, opts, dygraph, vals) -> [{v: ..., label: ...}, ...]",
289 "parameters": [
290 [ "min" , "" ],
291 [ "max" , "" ],
292 [ "pixels" , "" ],
293 [ "opts" , "" ],
294 [ "dygraph" , "the reference graph" ],
295 [ "vals" , "" ]
296 ],
297 "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."
298 },
299 "xAxisLabelWidth": {
300 "default": "50",
301 "labels": ["Axis display"],
302 "type": "integer",
303 "description": "Width, in pixels, of the x-axis labels."
304 },
305 "xAxisHeight": {
306 "default": "(null)",
307 "labels": ["Axis display"],
308 "type": "integer",
309 "description": "Height, in pixels, of the x-axis. If not set explicitly, this is computed based on axisLabelFontSize and axisTickSize."
310 },
311 "showLabelsOnHighlight": {
312 "default": "true",
313 "labels": ["Interactive Elements", "Legend"],
314 "type": "boolean",
315 "description": "Whether to show the legend upon mouseover."
316 },
317 "axis": {
318 "default": "(none)",
319 "labels": ["Axis display"],
320 "type": "string or object",
321 "description": "Set to either an object ({}) filled with options for this axis or to the name of an existing data series with its own axis to re-use that axis. See tests for usage."
322 },
323 "pixelsPerXLabel": {
324 "default": "",
325 "labels": ["Deprecated"],
326 "type": "integer",
327 "description": "Prefer axes { x: { pixelsPerLabel } }"
328 },
329 "pixelsPerLabel": {
330 "default": "60 (x-axis) or 30 (y-axes)",
331 "labels": ["Axis display", "Grid"],
332 "type": "integer",
333 "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."
334 },
335 "labelsDiv": {
336 "default": "null",
337 "labels": ["Legend"],
338 "type": "DOM element or string",
339 "example": "<code style='font-size: small'>document.getElementById('foo')</code>or<code>'foo'",
340 "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."
341 },
342 "fractions": {
343 "default": "false",
344 "labels": ["CSV parsing", "Error Bars"],
345 "type": "boolean",
346 "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)."
347 },
348 "logscale": {
349 "default": "false",
350 "labels": ["Axis display"],
351 "type": "boolean",
352 "description": "When set for a y-axis, the graph shows that axis in log scale. Any values less than or equal to zero are not displayed.\n\nNot compatible with showZero, and ignores connectSeparatedPoints. Also, showing log scale with valueRanges that are less than zero will result in an unviewable graph."
353 },
354 "strokeWidth": {
355 "default": "1.0",
356 "labels": ["Data Line display"],
357 "type": "integer",
358 "example": "0.5, 2.0",
359 "description": "The width of the lines connecting data points. This can be used to increase the contrast or some graphs."
360 },
361 "strokePattern": {
362 "default": "null",
363 "labels": ["Data Line display"],
364 "type": "array<integer>",
365 "example": "[10, 2, 5, 2]",
366 "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."
367 },
368 "wilsonInterval": {
369 "default": "true",
370 "labels": ["Error Bars"],
371 "type": "boolean",
372 "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."
373 },
374 "fillGraph": {
375 "default": "false",
376 "labels": ["Data Line display"],
377 "type": "boolean",
378 "description": "Should the area underneath the graph be filled? This option is not compatible with error bars."
379 },
380 "highlightCircleSize": {
381 "default": "3",
382 "labels": ["Interactive Elements"],
383 "type": "integer",
384 "description": "The size in pixels of the dot drawn over highlighted points."
385 },
386 "gridLineColor": {
387 "default": "rgb(128,128,128)",
388 "labels": ["Grid"],
389 "type": "red, blue",
390 "description": "The color of the gridlines."
391 },
392 "visibility": {
393 "default": "[true, true, ...]",
394 "labels": ["Data Line display"],
395 "type": "Array of booleans",
396 "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."
397 },
398 "valueRange": {
399 "default": "Full range of the input is shown",
400 "labels": ["Axis display"],
401 "type": "Array of two numbers",
402 "example": "[10, 110]",
403 "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."
404 },
405 "labelsDivWidth": {
406 "default": "250",
407 "labels": ["Legend"],
408 "type": "integer",
409 "description": "Width (in pixels) of the div which shows information on the currently-highlighted points."
410 },
411 "colorSaturation": {
412 "default": "1.0",
413 "labels": ["Data Series Colors"],
414 "type": "float (0.0 - 1.0)",
415 "description": "If <strong>colors</strong> is not specified, saturation of the automatically-generated data series colors."
416 },
417 "yAxisLabelWidth": {
418 "default": "50",
419 "labels": ["Axis display"],
420 "type": "integer",
421 "description": "Width, in pixels, of the y-axis labels. This also affects the amount of space available for a y-axis chart label."
422 },
423 "hideOverlayOnMouseOut": {
424 "default": "true",
425 "labels": ["Interactive Elements", "Legend"],
426 "type": "boolean",
427 "description": "Whether to hide the legend when the mouse leaves the chart area."
428 },
429 "yValueFormatter": {
430 "default": "",
431 "labels": ["Deprecated"],
432 "type": "",
433 "description": "Prefer axes: { y: { valueFormatter } }"
434 },
435 "legend": {
436 "default": "onmouseover",
437 "labels": ["Legend"],
438 "type": "string",
439 "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."
440 },
441 "labelsShowZeroValues": {
442 "default": "true",
443 "labels": ["Legend"],
444 "type": "boolean",
445 "description": "Show zero value labels in the labelsDiv."
446 },
447 "stepPlot": {
448 "default": "false",
449 "labels": ["Data Line display"],
450 "type": "boolean",
451 "description": "When set, display the graph as a step plot instead of a line plot."
452 },
453 "labelsKMB": {
454 "default": "false",
455 "labels": ["Value display/formatting"],
456 "type": "boolean",
457 "description": "Show K/M/B for thousands/millions/billions on y-axis."
458 },
459 "rightGap": {
460 "default": "5",
461 "labels": ["Overall display"],
462 "type": "integer",
463 "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."
464 },
465 "avoidMinZero": {
466 "default": "false",
467 "labels": ["Axis display"],
468 "type": "boolean",
469 "description": "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."
470 },
471 "xAxisLabelFormatter": {
472 "default": "",
473 "labels": ["Deprecated"],
474 "type": "",
475 "description": "Prefer axes { x: { axisLabelFormatter } }"
476 },
477 "axisLabelFormatter": {
478 "default": "Depends on the data type",
479 "labels": ["Axis display"],
480 "type": "function(number or Date, granularity, opts, dygraph)",
481 "parameters": [
482 [ "number or date" , "Either a number (for a numeric axis) or a Date object (for a date axis)" ],
483 [ "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." ],
484 [ "opts" , "a function which provides access to various options on the dygraph, e.g. opts('labelsKMB')." ],
485 [ "dygraph" , "the referenced graph" ]
486 ],
487 "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."
488 },
489 "clickCallback": {
490 "snippet": "function(e, date_millis){<br>&nbsp;&nbsp;alert(new Date(date_millis));<br>}",
491 "default": "null",
492 "labels": ["Callbacks"],
493 "type": "function(e, x, points)",
494 "parameters": [
495 [ "e" , "The event object for the click" ],
496 [ "x" , "The x value that was clicked (for dates, this is milliseconds since epoch)" ],
497 [ "points" , "The closest points along that date. See <a href='#point_properties'>Point properties</a> for details." ]
498 ],
499 "description": "A function to call when the canvas is clicked."
500 },
501 "yAxisLabelFormatter": {
502 "default": "",
503 "labels": ["Deprecated"],
504 "type": "",
505 "description": "Prefer axes: { y: { axisLabelFormatter } }"
506 },
507 "labels": {
508 "default": "[\"X\", \"Y1\", \"Y2\", ...]*",
509 "labels": ["Legend"],
510 "type": "array<string>",
511 "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."
512 },
513 "dateWindow": {
514 "default": "Full range of the input is shown",
515 "labels": ["Axis display"],
516 "type": "Array of two Dates or numbers",
517 "example": "[<br>&nbsp;&nbsp;Date.parse('2006-01-01'),<br>&nbsp;&nbsp;(new Date()).valueOf()<br>]",
518 "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."
519 },
520 "showRoller": {
521 "default": "false",
522 "labels": ["Interactive Elements", "Rolling Averages"],
523 "type": "boolean",
524 "description": "If the rolling average period text box should be shown."
525 },
526 "sigma": {
527 "default": "2.0",
528 "labels": ["Error Bars"],
529 "type": "float",
530 "description": "When errorBars is set, shade this many standard deviations above/below each point."
531 },
532 "customBars": {
533 "default": "false",
534 "labels": ["CSV parsing", "Error Bars"],
535 "type": "boolean",
536 "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."
537 },
538 "colorValue": {
539 "default": "1.0",
540 "labels": ["Data Series Colors"],
541 "type": "float (0.0 - 1.0)",
542 "description": "If colors is not specified, value of the data series colors, as in hue/saturation/value. (0.0-1.0, default 0.5)"
543 },
544 "errorBars": {
545 "default": "false",
546 "labels": ["CSV parsing", "Error Bars"],
547 "type": "boolean",
548 "description": "Does the data contain standard deviations? Setting this to true alters the input format (see above)."
549 },
550 "displayAnnotations": {
551 "default": "false",
552 "labels": ["Annotations"],
553 "type": "boolean",
554 "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."
555 },
556 "panEdgeFraction": {
557 "default": "null",
558 "labels": ["Axis display", "Interactive Elements"],
559 "type": "float",
560 "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."
561 },
562 "title": {
563 "labels": ["Chart labels"],
564 "type": "string",
565 "default": "null",
566 "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."
567 },
568 "titleHeight": {
569 "default": "18",
570 "labels": ["Chart labels"],
571 "type": "integer",
572 "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."
573 },
574 "xlabel": {
575 "labels": ["Chart labels"],
576 "type": "string",
577 "default": "null",
578 "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."
579 },
580 "xLabelHeight": {
581 "labels": ["Chart labels"],
582 "type": "integer",
583 "default": "18",
584 "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."
585 },
586 "ylabel": {
587 "labels": ["Chart labels"],
588 "type": "string",
589 "default": "null",
590 "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."
591 },
592 "y2label": {
593 "labels": ["Chart labels"],
594 "type": "string",
595 "default": "null",
596 "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."
597 },
598 "yLabelWidth": {
599 "labels": ["Chart labels"],
600 "type": "integer",
601 "default": "18",
602 "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."
603 },
604 "isZoomedIgnoreProgrammaticZoom" : {
605 "default": "false",
606 "labels": ["Zooming"],
607 "type": "boolean",
608 "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."
609 },
610 "drawXGrid": {
611 "default": "true",
612 "labels": ["Grid"],
613 "type": "boolean",
614 "description" : "Whether to display vertical gridlines under the chart."
615 },
616 "drawYGrid": {
617 "default": "true",
618 "labels": ["Grid"],
619 "type": "boolean",
620 "description" : "Whether to display horizontal gridlines under the chart."
621 },
622 "drawXAxis": {
623 "default": "true",
624 "labels": ["Axis display"],
625 "type": "boolean",
626 "description" : "Whether to draw the x-axis. Setting this to false also prevents x-axis ticks from being drawn and reclaims the space for the chart grid/lines."
627 },
628 "drawYAxis": {
629 "default": "true",
630 "labels": ["Axis display"],
631 "type": "boolean",
632 "description" : "Whether to draw the y-axis. Setting this to false also prevents y-axis ticks from being drawn and reclaims the space for the chart grid/lines."
633 },
634 "gridLineWidth": {
635 "default": "0.3",
636 "labels": ["Grid"],
637 "type": "float",
638 "description" : "Thickness (in pixels) of the gridlines drawn under the chart. The vertical/horizontal gridlines can be turned off entirely by using the drawXGrid and drawYGrid options."
639 },
640 "axisLineWidth": {
641 "default": "0.3",
642 "labels": ["Axis display"],
643 "type": "float",
644 "description" : "Thickness (in pixels) of the x- and y-axis lines."
645 },
646 "axisLineColor": {
647 "default": "black",
648 "labels": ["Axis display"],
649 "type": "string",
650 "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)'."
651 },
652 "fillAlpha": {
653 "default": "0.15",
654 "labels": ["Error Bars", "Data Series Colors"],
655 "type": "float (0.0 - 1.0)",
656 "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."
657 },
658 "axisLabelColor": {
659 "default": "black",
660 "labels": ["Axis display"],
661 "type": "string",
662 "description" : "Color for x- and y-axis labels. This is a CSS color string."
663 },
664 "axisLabelWidth": {
665 "default": "50",
666 "labels": ["Axis display", "Chart labels"],
667 "type": "integer",
668 "description" : "Width (in pixels) of the containing divs for x- and y-axis labels. For the y-axis, this also controls "
669 },
670 "sigFigs" : {
671 "default": "null",
672 "labels": ["Value display/formatting"],
673 "type": "integer",
674 "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."
675 },
676 "digitsAfterDecimal" : {
677 "default": "2",
678 "labels": ["Value display/formatting"],
679 "type": "integer",
680 "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."
681 },
682 "maxNumberWidth" : {
683 "default": "6",
684 "labels": ["Value display/formatting"],
685 "type": "integer",
686 "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."
687 },
688 "file": {
689 "default": "(set when constructed)",
690 "labels": ["Data"],
691 "type": "string (URL of CSV or CSV), GViz DataTable or 2D Array",
692 "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."
693 },
694 "timingName": {
695 "default": "null",
696 "labels": [ "Debugging" ],
697 "type": "string",
698 "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."
699 },
700 "showRangeSelector": {
701 "default": "false",
702 "labels": ["Interactive Elements"],
703 "type": "boolean",
704 "description": "Show the range selector widget. This option can only be specified at Dygraph creation time."
705 },
706 "rangeSelectorHeight": {
707 "default": "40",
708 "labels": ["Interactive Elements"],
709 "type": "integer",
710 "description": "Height, in pixels, of the range selector widget. This option can only be specified at Dygraph creation time."
711 },
712 "rangeSelectorPlotStrokeColor": {
713 "default": "#808FAB",
714 "labels": ["Interactive Elements"],
715 "type": "string",
716 "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."
717 },
718 "rangeSelectorPlotFillColor": {
719 "default": "#A7B1C4",
720 "labels": ["Interactive Elements"],
721 "type": "string",
722 "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."
723 },
724 "animatedZooms": {
725 "default": "false",
726 "labels": ["Interactive Elements"],
727 "type": "boolean",
728 "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."
729 }
730}
731; // </JSON>
732// NOTE: in addition to parsing as JS, this snippet is expected to be valid
733// JSON. This assumption cannot be checked in JS, but it will be checked when
734// documentation is generated by the generate-documentation.py script. For the
735// most part, this just means that you should always use double quotes.
736
737// Do a quick sanity check on the options reference.
738(function() {
739 "use strict";
740 var warn = function(msg) { if (console) console.warn(msg); };
741 var flds = ['type', 'default', 'description'];
742 var valid_cats = [
743 'Annotations',
744 'Axis display',
745 'Chart labels',
746 'CSV parsing',
747 'Callbacks',
748 'Data',
749 'Data Line display',
750 'Data Series Colors',
751 'Error Bars',
752 'Grid',
753 'Interactive Elements',
754 'Legend',
755 'Overall display',
756 'Rolling Averages',
757 'Value display/formatting',
758 'Zooming',
759 'Debugging',
760 'Deprecated'
761 ];
762 var i;
763 var cats = {};
764 for (i = 0; i < valid_cats.length; i++) cats[valid_cats[i]] = true;
765
766 for (var k in Dygraph.OPTIONS_REFERENCE) {
767 if (!Dygraph.OPTIONS_REFERENCE.hasOwnProperty(k)) continue;
768 var op = Dygraph.OPTIONS_REFERENCE[k];
769 for (i = 0; i < flds.length; i++) {
770 if (!op.hasOwnProperty(flds[i])) {
771 warn('Option ' + k + ' missing "' + flds[i] + '" property');
772 } else if (typeof(op[flds[i]]) != 'string') {
773 warn(k + '.' + flds[i] + ' must be of type string');
774 }
775 }
776 var labels = op.labels;
777 if (typeof(labels) !== 'object') {
778 warn('Option "' + k + '" is missing a "labels": [...] option');
779 } else {
780 for (i = 0; i < labels.length; i++) {
781 if (!cats.hasOwnProperty(labels[i])) {
782 warn('Option "' + k + '" has label "' + labels[i] +
783 '", which is invalid.');
784 }
785 }
786 }
787 }
788})();