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