X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph-canvas.js;h=04280c4946a81efa05e04dc8327683daea52d2ee;hb=1b89e01f33c071af04e0586163fa3c09ac115b09;hp=4ea5ef94a273b418ff6e3ed5c2d5dd461e1752d4;hpb=063e83bad654d6b5afcc156f7a2a0be4b2ea8e94;p=dygraphs.git diff --git a/dygraph-canvas.js b/dygraph-canvas.js index 4ea5ef9..04280c4 100644 --- a/dygraph-canvas.js +++ b/dygraph-canvas.js @@ -2,32 +2,22 @@ // All Rights Reserved. /** - * @fileoverview Based on PlotKit, but modified to meet the needs of dygraphs. + * @fileoverview Based on PlotKit.CanvasRenderer, but modified to meet the + * needs of dygraphs. + * * In particular, support for: * - grid overlays * - error bars * - dygraphs attribute system - * - * High level overview of classes: - * - * - DygraphLayout - * This contains all the data to be charted. - * It uses data coordinates, but also records the chart range (in data - * coordinates) and hence is able to calculate percentage positions ('In - * this view, Point A lies 25% down the x-axis.') - * Two things that it does not do are: - * 1. Record pixel coordinates for anything. - * 2. (oddly) determine anything about the layout of chart elements. - * The naming is a vestige of Dygraph's original PlotKit roots. - * - * - DygraphCanvasRenderer - * This class determines the charting area (in pixel coordinates), maps the - * percentage coordinates in the DygraphLayout to pixels and draws them. - * It's also responsible for creating chart DOM elements, i.e. annotations, - * tick mark labels, the title and the x/y-axis labels. */ /** + * This class determines the charting area (in pixel coordinates), maps the + * percentage coordinates in the DygraphLayout to pixels and draws them. + * It's also responsible for creating chart DOM elements, i.e. annotations, + * tick mark labels, the title and the x/y-axis labels. + * This class is based on PlotKit.CanvasRenderer. + * * Creates a new DygraphLayout object. * @return {Object} The DygraphLayout object */ @@ -70,7 +60,7 @@ DygraphLayout.prototype.setAnnotations = function(ann) { return; } Dygraph.update(a, ann[i]); - if (!a.xval) a.xval = parse(a.x); + if (!a.xval) a.xval = parse(a.x, this.dygraph_); this.annotations.push(a); } }; @@ -281,10 +271,12 @@ DygraphLayout.prototype.unstackPointAtIndex = function(idx) { /** * The DygraphCanvasRenderer class does the actual rendering of the chart onto * a canvas. It's based on PlotKit.CanvasRenderer. +>>>>>>> master * @param {Object} element The canvas to attach to * @param {Object} elementContext The 2d context of the canvas (injected so it * can be mocked for testing.) * @param {Layout} layout The DygraphLayout object for this graph. + * @constructor */ DygraphCanvasRenderer = function(dygraph, element, elementContext, layout) { this.dygraph_ = dygraph; @@ -523,6 +515,7 @@ DygraphCanvasRenderer.prototype._renderAxis = function() { zIndex: 10, color: this.attr_('axisLabelColor'), width: this.attr_('axisLabelWidth') + "px", + // height: this.attr_('axisLabelFontSize') + 2 + "px", overflow: "hidden" }; var makeDiv = function(txt, axis) {