Commit | Line | Data |
---|---|---|
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 | ||
9 | var OPTIONS_REFERENCE = null; | |
10 | ||
11 | // For "production" code, this gets removed by uglifyjs. | |
fd6b8dad | 12 | if (typeof(process) !== 'undefined') { |
7fea22be DV |
13 | if (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 | 19 | OPTIONS_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> 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}, … ]</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 >= 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><br/></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 | }, | |
302 | "interactionModel": { | |
303 | "default": "...", | |
304 | "labels": ["Interactive Elements"], | |
305 | "type": "Object", | |
306 | "description": "TODO(konigsberg): document this" | |
307 | }, | |
758a629f | 308 | "ticker": { |
74a5af31 DV |
309 | "default": "Dygraph.dateTicker or Dygraph.numericTicks", |
310 | "labels": ["Axis display"], | |
48e614ac | 311 | "type": "function(min, max, pixels, opts, dygraph, vals) -> [{v: ..., label: ...}, ...]", |
b5bdd85b RK |
312 | "parameters": [ |
313 | [ "min" , "" ], | |
314 | [ "max" , "" ], | |
315 | [ "pixels" , "" ], | |
316 | [ "opts" , "" ], | |
317 | [ "dygraph" , "the reference graph" ], | |
318 | [ "vals" , "" ] | |
319 | ], | |
758a629f | 320 | "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 | 321 | }, |
74a5af31 DV |
322 | "xAxisHeight": { |
323 | "default": "(null)", | |
324 | "labels": ["Axis display"], | |
325 | "type": "integer", | |
326 | "description": "Height, in pixels, of the x-axis. If not set explicitly, this is computed based on axisLabelFontSize and axisTickSize." | |
327 | }, | |
328 | "showLabelsOnHighlight": { | |
329 | "default": "true", | |
330 | "labels": ["Interactive Elements", "Legend"], | |
331 | "type": "boolean", | |
332 | "description": "Whether to show the legend upon mouseover." | |
333 | }, | |
334 | "axis": { | |
335 | "default": "(none)", | |
336 | "labels": ["Axis display"], | |
8498e5e8 DV |
337 | "type": "string", |
338 | "description": "Set to either 'y1' or 'y2' to assign a series to a y-axis (primary or secondary). Must be set per-series." | |
74a5af31 | 339 | }, |
48e614ac | 340 | "pixelsPerLabel": { |
d8dd8c2b | 341 | "default": "70 (x-axis) or 30 (y-axes)", |
74a5af31 DV |
342 | "labels": ["Axis display", "Grid"], |
343 | "type": "integer", | |
48e614ac | 344 | "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 |
345 | }, |
346 | "labelsDiv": { | |
347 | "default": "null", | |
348 | "labels": ["Legend"], | |
349 | "type": "DOM element or string", | |
350 | "example": "<code style='font-size: small'>document.getElementById('foo')</code>or<code>'foo'", | |
351 | "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." | |
352 | }, | |
353 | "fractions": { | |
354 | "default": "false", | |
355 | "labels": ["CSV parsing", "Error Bars"], | |
356 | "type": "boolean", | |
357 | "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)." | |
358 | }, | |
359 | "logscale": { | |
360 | "default": "false", | |
361 | "labels": ["Axis display"], | |
362 | "type": "boolean", | |
5b9b2142 | 363 | "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 |
364 | }, |
365 | "strokeWidth": { | |
366 | "default": "1.0", | |
367 | "labels": ["Data Line display"], | |
475f7420 | 368 | "type": "float", |
74a5af31 DV |
369 | "example": "0.5, 2.0", |
370 | "description": "The width of the lines connecting data points. This can be used to increase the contrast or some graphs." | |
371 | }, | |
79253bd0 | 372 | "strokePattern": { |
373 | "default": "null", | |
374 | "labels": ["Data Line display"], | |
375 | "type": "array<integer>", | |
376 | "example": "[10, 2, 5, 2]", | |
e2c21500 | 377 | "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 | 378 | }, |
857a6931 KW |
379 | "strokeBorderWidth": { |
380 | "default": "null", | |
381 | "labels": ["Data Line display"], | |
475f7420 KW |
382 | "type": "float", |
383 | "example": "1.0", | |
857a6931 KW |
384 | "description": "Draw a border around graph lines to make crossing lines more easily distinguishable. Useful for graphs with many lines." |
385 | }, | |
386 | "strokeBorderColor": { | |
387 | "default": "white", | |
388 | "labels": ["Data Line display"], | |
389 | "type": "string", | |
390 | "example": "red, #ccffdd", | |
391 | "description": "Color for the line border used if strokeBorderWidth is set." | |
392 | }, | |
74a5af31 DV |
393 | "wilsonInterval": { |
394 | "default": "true", | |
395 | "labels": ["Error Bars"], | |
396 | "type": "boolean", | |
397 | "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." | |
398 | }, | |
399 | "fillGraph": { | |
400 | "default": "false", | |
401 | "labels": ["Data Line display"], | |
402 | "type": "boolean", | |
cf8c87d4 | 403 | "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 |
404 | }, |
405 | "highlightCircleSize": { | |
406 | "default": "3", | |
407 | "labels": ["Interactive Elements"], | |
408 | "type": "integer", | |
409 | "description": "The size in pixels of the dot drawn over highlighted points." | |
410 | }, | |
411 | "gridLineColor": { | |
412 | "default": "rgb(128,128,128)", | |
413 | "labels": ["Grid"], | |
414 | "type": "red, blue", | |
86e9b1eb | 415 | "description": "The color of the gridlines. This may be set on a per-axis basis to define each axis' grid separately." |
74a5af31 | 416 | }, |
8887663f DV |
417 | "gridLinePattern": { |
418 | "default": "null", | |
419 | "labels": ["Grid"], | |
420 | "type": "array<integer>", | |
421 | "example": "[10, 2, 5, 2]", | |
422 | "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." | |
423 | }, | |
74a5af31 DV |
424 | "visibility": { |
425 | "default": "[true, true, ...]", | |
426 | "labels": ["Data Line display"], | |
427 | "type": "Array of booleans", | |
428 | "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." | |
429 | }, | |
430 | "valueRange": { | |
431 | "default": "Full range of the input is shown", | |
432 | "labels": ["Axis display"], | |
433 | "type": "Array of two numbers", | |
434 | "example": "[10, 110]", | |
1e1233b3 | 435 | "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 | 436 | }, |
74a5af31 DV |
437 | "colorSaturation": { |
438 | "default": "1.0", | |
439 | "labels": ["Data Series Colors"], | |
440 | "type": "float (0.0 - 1.0)", | |
441 | "description": "If <strong>colors</strong> is not specified, saturation of the automatically-generated data series colors." | |
442 | }, | |
74a5af31 DV |
443 | "hideOverlayOnMouseOut": { |
444 | "default": "true", | |
445 | "labels": ["Interactive Elements", "Legend"], | |
446 | "type": "boolean", | |
447 | "description": "Whether to hide the legend when the mouse leaves the chart area." | |
448 | }, | |
74a5af31 DV |
449 | "legend": { |
450 | "default": "onmouseover", | |
451 | "labels": ["Legend"], | |
452 | "type": "string", | |
a22cc809 | 453 | "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 | 454 | }, |
77ad1333 DV |
455 | "legendFormatter": { |
456 | "default": "null", | |
457 | "labels": ["Legend"], | |
ac928d20 DV |
458 | "type": "function(data): string", |
459 | "params": [ | |
460 | [ "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." ] | |
461 | ], | |
462 | "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 | 463 | }, |
74a5af31 DV |
464 | "labelsShowZeroValues": { |
465 | "default": "true", | |
466 | "labels": ["Legend"], | |
467 | "type": "boolean", | |
468 | "description": "Show zero value labels in the labelsDiv." | |
469 | }, | |
470 | "stepPlot": { | |
471 | "default": "false", | |
472 | "labels": ["Data Line display"], | |
473 | "type": "boolean", | |
104d87c5 | 474 | "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 | 475 | }, |
8c0599e3 | 476 | "labelsUTC": { |
872a6a00 | 477 | "default": "false", |
8c0599e3 | 478 | "labels": ["Value display/formatting", "Axis display"], |
872a6a00 DV |
479 | "type": "boolean", |
480 | "description": "Show date/time labels according to UTC (instead of local time)." | |
481 | }, | |
74a5af31 DV |
482 | "labelsKMB": { |
483 | "default": "false", | |
484 | "labels": ["Value display/formatting"], | |
485 | "type": "boolean", | |
486 | "description": "Show K/M/B for thousands/millions/billions on y-axis." | |
487 | }, | |
488 | "rightGap": { | |
489 | "default": "5", | |
490 | "labels": ["Overall display"], | |
491 | "type": "integer", | |
492 | "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." | |
493 | }, | |
f4b87da2 KW |
494 | "drawAxesAtZero": { |
495 | "default": "false", | |
496 | "labels": ["Axis display"], | |
497 | "type": "boolean", | |
498 | "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." | |
499 | }, | |
fa460473 KW |
500 | "xRangePad": { |
501 | "default": "0", | |
502 | "labels": ["Axis display"], | |
503 | "type": "float", | |
504 | "description": "Add the specified amount of extra space (in pixels) around the X-axis value range to ensure points at the edges remain visible." | |
505 | }, | |
506 | "yRangePad": { | |
507 | "default": "null", | |
508 | "labels": ["Axis display"], | |
509 | "type": "float", | |
510 | "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." | |
511 | }, | |
48e614ac DV |
512 | "axisLabelFormatter": { |
513 | "default": "Depends on the data type", | |
514 | "labels": ["Axis display"], | |
515 | "type": "function(number or Date, granularity, opts, dygraph)", | |
b5bdd85b RK |
516 | "parameters": [ |
517 | [ "number or date" , "Either a number (for a numeric axis) or a Date object (for a date axis)" ], | |
518 | [ "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." ], | |
519 | [ "opts" , "a function which provides access to various options on the dygraph, e.g. opts('labelsKMB')." ], | |
520 | [ "dygraph" , "the referenced graph" ] | |
521 | ], | |
522 | "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 |
523 | }, |
524 | "clickCallback": { | |
e6e12f18 | 525 | "snippet": "function(e, date_millis){<br> alert(new Date(date_millis));<br>}", |
74a5af31 DV |
526 | "default": "null", |
527 | "labels": ["Callbacks"], | |
e6e12f18 | 528 | "type": "function(e, x, points)", |
b5bdd85b RK |
529 | "parameters": [ |
530 | [ "e" , "The event object for the click" ], | |
531 | [ "x" , "The x value that was clicked (for dates, this is milliseconds since epoch)" ], | |
532 | [ "points" , "The closest points along that date. See <a href='#point_properties'>Point properties</a> for details." ] | |
533 | ], | |
534 | "description": "A function to call when the canvas is clicked." | |
74a5af31 | 535 | }, |
74a5af31 DV |
536 | "labels": { |
537 | "default": "[\"X\", \"Y1\", \"Y2\", ...]*", | |
538 | "labels": ["Legend"], | |
539 | "type": "array<string>", | |
540 | "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." | |
541 | }, | |
542 | "dateWindow": { | |
543 | "default": "Full range of the input is shown", | |
544 | "labels": ["Axis display"], | |
b78c3349 | 545 | "type": "Array of two numbers", |
74a5af31 DV |
546 | "example": "[<br> Date.parse('2006-01-01'),<br> (new Date()).valueOf()<br>]", |
547 | "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." | |
548 | }, | |
549 | "showRoller": { | |
550 | "default": "false", | |
551 | "labels": ["Interactive Elements", "Rolling Averages"], | |
552 | "type": "boolean", | |
553 | "description": "If the rolling average period text box should be shown." | |
554 | }, | |
555 | "sigma": { | |
556 | "default": "2.0", | |
557 | "labels": ["Error Bars"], | |
558 | "type": "float", | |
559 | "description": "When errorBars is set, shade this many standard deviations above/below each point." | |
560 | }, | |
561 | "customBars": { | |
562 | "default": "false", | |
563 | "labels": ["CSV parsing", "Error Bars"], | |
564 | "type": "boolean", | |
565 | "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." | |
566 | }, | |
567 | "colorValue": { | |
568 | "default": "1.0", | |
569 | "labels": ["Data Series Colors"], | |
570 | "type": "float (0.0 - 1.0)", | |
571 | "description": "If colors is not specified, value of the data series colors, as in hue/saturation/value. (0.0-1.0, default 0.5)" | |
572 | }, | |
573 | "errorBars": { | |
574 | "default": "false", | |
575 | "labels": ["CSV parsing", "Error Bars"], | |
576 | "type": "boolean", | |
577 | "description": "Does the data contain standard deviations? Setting this to true alters the input format (see above)." | |
578 | }, | |
579 | "displayAnnotations": { | |
580 | "default": "false", | |
581 | "labels": ["Annotations"], | |
582 | "type": "boolean", | |
583 | "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." | |
584 | }, | |
585 | "panEdgeFraction": { | |
586 | "default": "null", | |
587 | "labels": ["Axis display", "Interactive Elements"], | |
588 | "type": "float", | |
c0e7b625 | 589 | "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 |
590 | }, |
591 | "title": { | |
592 | "labels": ["Chart labels"], | |
593 | "type": "string", | |
594 | "default": "null", | |
595 | "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." | |
596 | }, | |
597 | "titleHeight": { | |
598 | "default": "18", | |
599 | "labels": ["Chart labels"], | |
600 | "type": "integer", | |
601 | "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." | |
602 | }, | |
603 | "xlabel": { | |
604 | "labels": ["Chart labels"], | |
605 | "type": "string", | |
606 | "default": "null", | |
607 | "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." | |
608 | }, | |
609 | "xLabelHeight": { | |
610 | "labels": ["Chart labels"], | |
611 | "type": "integer", | |
612 | "default": "18", | |
613 | "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." | |
614 | }, | |
615 | "ylabel": { | |
616 | "labels": ["Chart labels"], | |
617 | "type": "string", | |
618 | "default": "null", | |
619 | "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." | |
620 | }, | |
d0c39108 DV |
621 | "y2label": { |
622 | "labels": ["Chart labels"], | |
623 | "type": "string", | |
624 | "default": "null", | |
625 | "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." | |
626 | }, | |
74a5af31 DV |
627 | "yLabelWidth": { |
628 | "labels": ["Chart labels"], | |
629 | "type": "integer", | |
630 | "default": "18", | |
631 | "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." | |
632 | }, | |
86e9b1eb | 633 | "drawGrid": { |
97adf46b DE |
634 | "default": "true for x and y, false for y2", |
635 | "labels": ["Grid"], | |
636 | "type": "boolean", | |
637 | "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 |
638 | }, |
639 | "independentTicks": { | |
6c5f8774 | 640 | "default": "true for y, false for y2", |
97adf46b DE |
641 | "labels": ["Axis display", "Grid"], |
642 | "type": "boolean", | |
6c5f8774 | 643 | "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 | 644 | }, |
7f6a7190 RK |
645 | "drawAxis": { |
646 | "default": "true for x and y, false for y2", | |
647 | "labels": ["Axis display"], | |
648 | "type": "boolean", | |
649 | "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 |
650 | }, |
651 | "gridLineWidth": { | |
652 | "default": "0.3", | |
653 | "labels": ["Grid"], | |
654 | "type": "float", | |
bfb3e0a4 | 655 | "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 |
656 | }, |
657 | "axisLineWidth": { | |
658 | "default": "0.3", | |
659 | "labels": ["Axis display"], | |
660 | "type": "float", | |
661 | "description" : "Thickness (in pixels) of the x- and y-axis lines." | |
662 | }, | |
663 | "axisLineColor": { | |
664 | "default": "black", | |
665 | "labels": ["Axis display"], | |
666 | "type": "string", | |
667 | "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)'." | |
668 | }, | |
669 | "fillAlpha": { | |
670 | "default": "0.15", | |
671 | "labels": ["Error Bars", "Data Series Colors"], | |
672 | "type": "float (0.0 - 1.0)", | |
673 | "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." | |
674 | }, | |
74a5af31 | 675 | "axisLabelWidth": { |
d8dd8c2b | 676 | "default": "50 (y-axis), 60 (x-axis)", |
74a5af31 DV |
677 | "labels": ["Axis display", "Chart labels"], |
678 | "type": "integer", | |
d8dd8c2b | 679 | "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 |
680 | }, |
681 | "sigFigs" : { | |
682 | "default": "null", | |
683 | "labels": ["Value display/formatting"], | |
684 | "type": "integer", | |
685 | "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." | |
686 | }, | |
687 | "digitsAfterDecimal" : { | |
688 | "default": "2", | |
689 | "labels": ["Value display/formatting"], | |
690 | "type": "integer", | |
691 | "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." | |
692 | }, | |
693 | "maxNumberWidth" : { | |
694 | "default": "6", | |
695 | "labels": ["Value display/formatting"], | |
696 | "type": "integer", | |
697 | "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." | |
698 | }, | |
699 | "file": { | |
700 | "default": "(set when constructed)", | |
701 | "labels": ["Data"], | |
702 | "type": "string (URL of CSV or CSV), GViz DataTable or 2D Array", | |
703 | "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 |
704 | }, |
705 | "timingName": { | |
706 | "default": "null", | |
fd6b8dad | 707 | "labels": [ "Debugging", "Deprecated" ], |
7153e001 DV |
708 | "type": "string", |
709 | "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 |
710 | }, |
711 | "showRangeSelector": { | |
712 | "default": "false", | |
2555a4ed | 713 | "labels": ["Range Selector"], |
ccd9d7c2 | 714 | "type": "boolean", |
0d216a60 | 715 | "description": "Show or hide the range selector widget." |
ccd9d7c2 PF |
716 | }, |
717 | "rangeSelectorHeight": { | |
718 | "default": "40", | |
2555a4ed | 719 | "labels": ["Range Selector"], |
ccd9d7c2 PF |
720 | "type": "integer", |
721 | "description": "Height, in pixels, of the range selector widget. This option can only be specified at Dygraph creation time." | |
722 | }, | |
723 | "rangeSelectorPlotStrokeColor": { | |
724 | "default": "#808FAB", | |
2555a4ed | 725 | "labels": ["Range Selector"], |
ccd9d7c2 PF |
726 | "type": "string", |
727 | "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." | |
728 | }, | |
729 | "rangeSelectorPlotFillColor": { | |
730 | "default": "#A7B1C4", | |
2555a4ed | 731 | "labels": ["Range Selector"], |
ccd9d7c2 PF |
732 | "type": "string", |
733 | "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 | 734 | }, |
79cb28dd | 735 | "rangeSelectorPlotFillGradientColor": { |
736 | "default": "white", | |
2555a4ed | 737 | "labels": ["Range Selector"], |
79cb28dd | 738 | "type": "string", |
739 | "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." | |
740 | }, | |
fb24d32c | 741 | "rangeSelectorBackgroundStrokeColor": { |
b77d7a56 | 742 | "default": "gray", |
2555a4ed | 743 | "labels": ["Range Selector"], |
b77d7a56 | 744 | "type": "string", |
745 | "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\"." | |
746 | }, | |
fb24d32c | 747 | "rangeSelectorBackgroundLineWidth": { |
b77d7a56 | 748 | "default": "1", |
2555a4ed | 749 | "labels": ["Range Selector"], |
b77d7a56 | 750 | "type": "float", |
751 | "description": "The width of the lines below and on both sides of the range selector mini plot." | |
752 | }, | |
753 | "rangeSelectorPlotLineWidth": { | |
754 | "default": "1.5", | |
2555a4ed | 755 | "labels": ["Range Selector"], |
b77d7a56 | 756 | "type": "float", |
757 | "description": "The width of the range selector mini plot line." | |
b77d7a56 | 758 | }, |
fb24d32c | 759 | "rangeSelectorForegroundStrokeColor": { |
b77d7a56 | 760 | "default": "black", |
2555a4ed | 761 | "labels": ["Range Selector"], |
b77d7a56 | 762 | "type": "string", |
763 | "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\"." | |
764 | }, | |
fb24d32c | 765 | "rangeSelectorForegroundLineWidth": { |
b77d7a56 | 766 | "default": "1", |
2555a4ed | 767 | "labels": ["Range Selector"], |
b77d7a56 | 768 | "type": "float", |
769 | "description": "The width the lines in the interactive layer of the range selector." | |
770 | }, | |
771 | "rangeSelectorAlpha": { | |
772 | "default": "0.6", | |
2555a4ed | 773 | "labels": ["Range Selector"], |
b77d7a56 | 774 | "type": "float (0.0 - 1.0)", |
775 | "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." | |
776 | }, | |
0a0885d1 | 777 | "showInRangeSelector": { |
1085dbce | 778 | "default": "null", |
2555a4ed | 779 | "labels": ["Range Selector"], |
0a0885d1 | 780 | "type": "boolean", |
6ed703fd | 781 | "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 | 782 | }, |
b1a3b195 DV |
783 | "animatedZooms": { |
784 | "default": "false", | |
785 | "labels": ["Interactive Elements"], | |
786 | "type": "boolean", | |
787 | "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 |
788 | }, |
789 | "plotter": { | |
790 | "default": "[DygraphCanvasRenderer.Plotters.fillPlotter, DygraphCanvasRenderer.Plotters.errorPlotter, DygraphCanvasRenderer.Plotters.linePlotter]", | |
791 | "labels": ["Data Line display"], | |
792 | "type": "array or function", | |
793 | "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 | 794 | }, |
8887663f DV |
795 | "axes": { |
796 | "default": "null", | |
797 | "labels": ["Configuration"], | |
798 | "type": "Object", | |
799 | "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>." | |
800 | }, | |
73e953cd RK |
801 | "series": { |
802 | "default": "null", | |
803 | "labels": ["Series"], | |
38f280e5 | 804 | "type": "Object", |
0a5aa490 | 805 | "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 |
806 | }, |
807 | "plugins": { | |
808 | "default": "[]", | |
809 | "labels": ["Configuration"], | |
eced46cf | 810 | "type": "Array<plugin>", |
3ea41d86 DV |
811 | "description": "Defines per-graph plugins. Useful for per-graph customization" |
812 | }, | |
813 | "dataHandler": { | |
814 | "default": "(depends on data)", | |
815 | "labels": ["Data"], | |
816 | "type": "Dygraph.DataHandler", | |
817 | "description": "Custom DataHandler. This is an advanced customization. See http://bit.ly/151E7Aq." | |
73e953cd | 818 | } |
74a5af31 DV |
819 | } |
820 | ; // </JSON> | |
821 | // NOTE: in addition to parsing as JS, this snippet is expected to be valid | |
822 | // JSON. This assumption cannot be checked in JS, but it will be checked when | |
823 | // documentation is generated by the generate-documentation.py script. For the | |
824 | // most part, this just means that you should always use double quotes. | |
825 | ||
826 | // Do a quick sanity check on the options reference. | |
7fea22be DV |
827 | var warn = function(msg) { if (window.console) window.console.warn(msg); }; |
828 | var flds = ['type', 'default', 'description']; | |
829 | var valid_cats = [ | |
830 | 'Annotations', | |
831 | 'Axis display', | |
832 | 'Chart labels', | |
833 | 'CSV parsing', | |
834 | 'Callbacks', | |
835 | 'Data', | |
836 | 'Data Line display', | |
837 | 'Data Series Colors', | |
838 | 'Error Bars', | |
839 | 'Grid', | |
840 | 'Interactive Elements', | |
841 | 'Range Selector', | |
842 | 'Legend', | |
843 | 'Overall display', | |
844 | 'Rolling Averages', | |
845 | 'Series', | |
846 | 'Value display/formatting', | |
847 | 'Zooming', | |
848 | 'Debugging', | |
849 | 'Configuration', | |
850 | 'Deprecated' | |
851 | ]; | |
852 | var i; | |
853 | var cats = {}; | |
854 | for (i = 0; i < valid_cats.length; i++) cats[valid_cats[i]] = true; | |
74a5af31 | 855 | |
7fea22be DV |
856 | for (var k in OPTIONS_REFERENCE) { |
857 | if (!OPTIONS_REFERENCE.hasOwnProperty(k)) continue; | |
858 | var op = OPTIONS_REFERENCE[k]; | |
859 | for (i = 0; i < flds.length; i++) { | |
860 | if (!op.hasOwnProperty(flds[i])) { | |
861 | warn('Option ' + k + ' missing "' + flds[i] + '" property'); | |
862 | } else if (typeof(op[flds[i]]) != 'string') { | |
863 | warn(k + '.' + flds[i] + ' must be of type string'); | |
74a5af31 | 864 | } |
7fea22be DV |
865 | } |
866 | var labels = op.labels; | |
867 | if (typeof(labels) !== 'object') { | |
868 | warn('Option "' + k + '" is missing a "labels": [...] option'); | |
869 | } else { | |
870 | for (i = 0; i < labels.length; i++) { | |
871 | if (!cats.hasOwnProperty(labels[i])) { | |
872 | warn('Option "' + k + '" has label "' + labels[i] + | |
873 | '", which is invalid.'); | |
74a5af31 DV |
874 | } |
875 | } | |
876 | } | |
7fea22be DV |
877 | } |
878 | ||
879 | } | |
fd6b8dad | 880 | } |
7fea22be DV |
881 | |
882 | export default OPTIONS_REFERENCE; |