X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;ds=sidebyside;f=dygraph-layout.js;h=81274ed621817261a457d9f646739fdf8b2723c5;hb=441e4a56ca59ee633813adfeb3162cfbf1c4fc49;hp=ac1eca0ade8714177782893e333bbf0cf4fb849c;hpb=eed32275fbd3d81b84467853b1781fa4293f3b85;p=dygraphs.git diff --git a/dygraph-layout.js b/dygraph-layout.js index ac1eca0..81274ed 100644 --- a/dygraph-layout.js +++ b/dygraph-layout.js @@ -69,6 +69,38 @@ DygraphLayout.prototype.computePlotArea_ = function() { area.w = this.dygraph_.width_ - area.x - this.attr_('rightGap'); area.h = this.dygraph_.height_; + + // Let plugins reserve space. + var e = { + chart_div: this.dygraph_.graphDiv, + reserveSpaceLeft: function(px) { + var r = { + x: area.x, + y: area.y, + w: px, + h: area.h + }; + area.x += px; + area.w -= px; + return r; + }, + reserveSpaceTop: function(px) { + var r = { + x: area.x, + y: area.y, + w: area.w, + h: px + }; + area.y += px; + area.h -= px; + return r; + }, + chartRect: function() { + return {x:area.x, y:area.y, w:area.w, h:area.h}; + } + }; + this.dygraph_.cascadeEvents_('layout', e); + if (this.attr_('drawXAxis')) { if (this.attr_('xAxisHeight')) { area.h -= this.attr_('xAxisHeight'); @@ -86,6 +118,7 @@ DygraphLayout.prototype.computePlotArea_ = function() { "to use " + this.dygraph_.numAxes() + ")"); } +/* // Add space for chart labels: title, xlabel and ylabel. if (this.attr_('title')) { area.h -= this.attr_('titleHeight'); @@ -105,6 +138,7 @@ DygraphLayout.prototype.computePlotArea_ = function() { // same logic applies here as for ylabel. // TODO(danvk): make yAxisLabelWidth a per-axis property } +*/ // Add space for range selector, if needed. if (this.attr_('showRangeSelector')) {