From: Robert Konigsberg Date: Sat, 25 Feb 2012 09:02:39 +0000 (-0500) Subject: Add "parameters" specification to docs; indented rendering. X-Git-Tag: v1.0.0~324 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=b5bdd85b1a969707aa52a0253712fdab7f2108ce;p=dygraphs.git Add "parameters" specification to docs; indented rendering. --- diff --git a/dygraph-options-reference.js b/dygraph-options-reference.js index a94a54f..7f16cf2 100644 --- a/dygraph-options-reference.js +++ b/dygraph-options-reference.js @@ -53,14 +53,23 @@ Dygraph.OPTIONS_REFERENCE = // "default": "null", "labels": ["Callbacks"], "type": "function(minDate, maxDate, yRanges)", - "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." + "parameters": [ + [ "minDate" , "milliseconds since epoch" ], + [ "maxDate" , "milliseconds since epoch." ], + [ "yRanges" , "is an array of [bottom, top] pairs, one for each y-axis." ] + ], + "description": "A function to call when the zoom window is changed (either by zooming in or out)." }, "pointClickCallback": { "snippet": "function(e, point){
  alert(point);
}", "default": "null", "labels": ["Callbacks", "Interactive Elements"], "type": "function(e, point)", - "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" + "parameters": [ + [ "e" , "the event object for the click" ], + [ "point" , "the point that was clicked See Point properties for details" ] + ], + "description": "A function to call when a data point is clicked. and the point that was clicked." }, "colors": { "default": "(see description)", @@ -78,8 +87,14 @@ Dygraph.OPTIONS_REFERENCE = // "highlightCallback": { "default": "null", "labels": ["Callbacks"], - "type": "function(event, x, points,row)", - "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: [ {name: 'series', yval: y-value}, … ]" + "type": "function(event, x, points, row)", + "description": "When set, this callback gets called every time a new point is highlighted.", + "parameters": [ + ["event", "the JavaScript mousemove event"], + ["x", "the x-coordinate of the highlighted points"], + ["points", "an array of highlighted points: [ {name: 'series', yval: y-value}, … ]"], + ["row", "???"] + ] }, "includeZero": { "default": "false", @@ -97,7 +112,10 @@ Dygraph.OPTIONS_REFERENCE = // "default": "null", "labels": ["Callbacks"], "type": "function(event)", - "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." + "parameters": [ + [ "event" , "the mouse event" ] + ], + "description": "When set, this callback gets called every time the user stops highlighting any point by mousing out of the graph." }, "axisTickSize": { "default": "3.0", @@ -139,25 +157,47 @@ Dygraph.OPTIONS_REFERENCE = // "default": "null", "labels": ["Annotations"], "type": "function(annotation, point, dygraph, event)", + "parameters": [ + [ "annotation" , "the annotation left" ], + [ "point" , "the point associated with the annotation" ], + [ "dygraph" , "the reference graph" ], + [ "event" , "the mouse event" ] + ], "description": "If provided, this function is called whenever the user mouses out of an annotation." }, "annotationClickHandler": { "default": "null", "labels": ["Annotations"], "type": "function(annotation, point, dygraph, event)", + "parameters": [ + [ "annotation" , "the annotation left" ], + [ "point" , "the point associated with the annotation" ], + [ "dygraph" , "the reference graph" ], + [ "event" , "the mouse event" ] + ], "description": "If provided, this function is called whenever the user clicks on an annotation." }, "annotationDblClickHandler": { "default": "null", "labels": ["Annotations"], "type": "function(annotation, point, dygraph, event)", + "parameters": [ + [ "annotation" , "the annotation left" ], + [ "point" , "the point associated with the annotation" ], + [ "dygraph" , "the reference graph" ], + [ "event" , "the mouse event" ] + ], "description": "If provided, this function is called whenever the user double-clicks on an annotation." }, "drawCallback": { "default": "null", "labels": ["Callbacks"], "type": "function(dygraph, is_initial)", - "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." + "parameters": [ + [ "dygraph" , "The graph being drawn" ], + [ "is_initial" , "True if this is the initial draw, false for subsequent draws." ] + ], + "description": "When set, this callback gets called every time the dygraph is drawn. This includes the initial draw, after zooming and repeatedly while panning." }, "labelsKMG2": { "default": "false", @@ -181,6 +221,11 @@ Dygraph.OPTIONS_REFERENCE = // "default": "null", "labels": ["Callbacks"], "type": "function(canvas, area, dygraph)", + "parameters": [ + [ "canvas" , "the canvas to draw on" ], + [ "area" , "" ], + [ "dygraph" , "the reference graph" ] + ], "description": "When set, this callback gets called before the chart is drawn. It details on how to use this." }, "width": { @@ -199,6 +244,14 @@ Dygraph.OPTIONS_REFERENCE = // "default": "Dygraph.dateTicker or Dygraph.numericTicks", "labels": ["Axis display"], "type": "function(min, max, pixels, opts, dygraph, vals) -> [{v: ..., label: ...}, ...]", + "parameters": [ + [ "min" , "" ], + [ "max" , "" ], + [ "pixels" , "" ], + [ "opts" , "" ], + [ "dygraph" , "the reference graph" ], + [ "vals" , "" ] + ], "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 per-axis basis." }, "xAxisLabelWidth": { @@ -383,14 +436,25 @@ Dygraph.OPTIONS_REFERENCE = // "default": "Depends on the data type", "labels": ["Axis display"], "type": "function(number or Date, granularity, opts, dygraph)", - "description": "Function to call to format the tick values that appear along an axis. This is usually set on a per-axis 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')." + "parameters": [ + [ "number or date" , "Either a number (for a numeric axis) or a Date object (for a date axis)" ], + [ "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." ], + [ "opts" , "a function which provides access to various options on the dygraph, e.g. opts('labelsKMB')." ], + [ "dygraph" , "the referenced graph" ] + ], + "description": "Function to call to format the tick values that appear along an axis. This is usually set on a per-axis basis." }, "clickCallback": { "snippet": "function(e, date_millis){
  alert(new Date(date_millis));
}", "default": "null", "labels": ["Callbacks"], "type": "function(e, x, points)", - "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" + "parameters": [ + [ "e" , "The event object for the click" ], + [ "x" , "The x value that was clicked (for dates, this is milliseconds since epoch)" ], + [ "points" , "The closest points along that date. See Point properties for details." ] + ], + "description": "A function to call when the canvas is clicked." }, "yAxisLabelFormatter": { "default": "", diff --git a/generate-documentation.py b/generate-documentation.py index 2dd5b98..0614bef 100755 --- a/generate-documentation.py +++ b/generate-documentation.py @@ -71,7 +71,7 @@ for nu, opt in docs.iteritems(): if label not in labels: labels.append(label) -print """ +print """ Dygraphs Options Reference @@ -80,6 +80,9 @@ print """ p.option { padding-left: 25px; } + div.parameters { + padding-left: 15px; + } #nav { position: fixed; } @@ -92,7 +95,7 @@ print """ """ print """ -