X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph-canvas.js;h=471d9e4071b820c487b1b0e5919c3ce29a82ad70;hb=da1369a5acf5304973dcc061c6682fd167ee67da;hp=3aba3cd346f80c35b25f9c1939e1aa56ed8ac5c4;hpb=600d841a16aaebfd39cabfa387a8043510c9a113;p=dygraphs.git diff --git a/dygraph-canvas.js b/dygraph-canvas.js index 3aba3cd..471d9e4 100644 --- a/dygraph-canvas.js +++ b/dygraph-canvas.js @@ -334,12 +334,18 @@ DygraphCanvasRenderer.prototype.attr_ = function(x) { DygraphCanvasRenderer.prototype.computeArea_ = function() { var area = { // TODO(danvk): per-axis setting. - x: this.attr_('yAxisLabelWidth') + 2 * this.attr_('axisTickSize'), + x: 0, y: 0 }; + if (this.attr_('drawYAxis')) { + area.x = this.attr_('yAxisLabelWidth') + 2 * this.attr_('axisTickSize'); + } + area.w = this.width - area.x - this.attr_('rightGap'); - area.h = this.height - this.attr_('axisLabelFontSize') - - 2 * this.attr_('axisTickSize'); + area.h = this.height; + if (this.attr_('drawXAxis')) { + area.h -= this.attr_('axisLabelFontSize') + 2 * this.attr_('axisTickSize'); + } // Shrink the drawing area to accomodate additional y-axes. if (this.dygraph_.numAxes() == 2) { @@ -460,7 +466,7 @@ DygraphCanvasRenderer.prototype.render = function() { var ticks = this.layout.yticks; ctx.save(); ctx.strokeStyle = this.attr_('gridLineColor'); - ctx.lineWidth = this.attr_('axisLineWidth'); + ctx.lineWidth = this.attr_('gridLineWidth'); for (var i = 0; i < ticks.length; i++) { // TODO(danvk): allow secondary axes to draw a grid, too. if (ticks[i][0] != 0) continue; @@ -478,7 +484,7 @@ DygraphCanvasRenderer.prototype.render = function() { var ticks = this.layout.xticks; ctx.save(); ctx.strokeStyle = this.attr_('gridLineColor'); - ctx.lineWidth = this.attr_('axisLineWidth'); + ctx.lineWidth = this.attr_('gridLineWidth'); for (var i=0; i