From: Robert Konigsberg Date: Sat, 30 Mar 2013 11:39:03 +0000 (-0400) Subject: Some closurifying dygraph-canvas and dygraph-layout. X-Git-Tag: v1.0.0~38^2~3 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=48fc47867e9796ad49e105546fbb21c5304039c1;p=dygraphs.git Some closurifying dygraph-canvas and dygraph-layout. --- diff --git a/dygraph-canvas.js b/dygraph-canvas.js index 2824003..b038fec 100644 --- a/dygraph-canvas.js +++ b/dygraph-canvas.js @@ -40,7 +40,7 @@ * renderer simply gets a drawing context. * * @param {Dygraph} dygraph The chart to which this renderer belongs. - * @param {Canvas} element The <canvas> DOM element on which to draw. + * @param {HTMLCanvasElement} element The <canvas> DOM element on which to draw. * @param {CanvasRenderingContext2D} elementContext The drawing context. * @param {DygraphLayout} layout The chart's DygraphLayout object. * @@ -58,6 +58,7 @@ var DygraphCanvasRenderer = function(dygraph, element, elementContext, layout) { this.width = this.element.width; // --- check whether everything is ok before we return + // NOTE(konigsberg): isIE is never defined in this object. Bug of some sort. if (!this.isIE && !(DygraphCanvasRenderer.isSupported(this.element))) throw "Canvas is not supported."; @@ -433,14 +434,15 @@ DygraphCanvasRenderer.prototype._updatePoints = function() { /** * Add canvas Actually draw the lines chart, including error bars. - * If opt_seriesName is specified, only that series will be drawn. - * (This is used for expedited redrawing with highlightSeriesOpts) - * Lines are typically drawn in the non-interactive dygraph canvas. If opt_ctx - * is specified, they can be drawn elsewhere. * * This function can only be called if DygraphLayout's points array has been * updated with canvas{x,y} attributes, i.e. by * DygraphCanvasRenderer._updatePoints. + * + * @param {string=} opt_seriesName when specified, only that series will + * be drawn. (This is used for expedited redrawing with highlightSeriesOpts) + * @param {CanvasRenderingContext2D} opt_ctx when specified, the drawing context. + * However, lines are typically drawn on the object's elementContext. * @private */ DygraphCanvasRenderer.prototype._renderLineChart = function(opt_seriesName, opt_ctx) { diff --git a/dygraph-layout.js b/dygraph-layout.js index 4caafc0..06106cd 100644 --- a/dygraph-layout.js +++ b/dygraph-layout.js @@ -52,6 +52,12 @@ DygraphLayout.prototype.addDataset = function(setname, set_xy) { this.setNames.push(setname); }; +/** + * Returns the box which the chart should be drawn in. This is the canvas's + * box, less space needed for the axis and chart labels. + * + * @return {{ x : numer, y : number, w : number, h : number }} + */ DygraphLayout.prototype.getPlotArea = function() { return this.area_; };