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