X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph-canvas.js;h=8a2c17bca2dfc97b1b236bdc6aae65ce6062420a;hb=7617164833913c65544c5686d4170d7a57f060ba;hp=3dfaf5f05435c961d69a8031e93e4150a828047c;hpb=05c9d0c47fbb3d9aef63aa00f303b1cfa0b7f310;p=dygraphs.git diff --git a/dygraph-canvas.js b/dygraph-canvas.js index 3dfaf5f..8a2c17b 100644 --- a/dygraph-canvas.js +++ b/dygraph-canvas.js @@ -182,7 +182,7 @@ DygraphCanvasRenderer = function(dygraph, element, layout, options) { MochiKit.Base.update(this.options, options); this.layout = layout; - this.element = MochiKit.DOM.getElement(element); + this.element = element; this.container = this.element.parentNode; // Stuff relating to Canvas on IE support @@ -215,8 +215,8 @@ DygraphCanvasRenderer = function(dygraph, element, layout, options) { this.area.h = this.height - this.options.axisLabelFontSize - 2 * this.options.axisTickSize; - MochiKit.DOM.updateNodeAttributes(this.container, - {"style":{ "position": "relative", "width": this.width + "px"}}); + this.container.style.position = "relative"; + this.container.style.width = this.width + "px"; }; DygraphCanvasRenderer.prototype.clear = function() { @@ -230,6 +230,7 @@ DygraphCanvasRenderer.prototype.clear = function() { var context = this.element.getContext("2d"); } catch (e) { + // TODO(danvk): this is broken, since MochiKit.Async is gone. this.clearDelay = MochiKit.Async.wait(this.IEDelay); this.clearDelay.addCallback(bind(this.clear, this)); return; @@ -240,10 +241,12 @@ DygraphCanvasRenderer.prototype.clear = function() { context.clearRect(0, 0, this.width, this.height); for (var i = 0; i < this.xlabels.length; i++) { - MochiKit.DOM.removeElement(this.xlabels[i]); + var el = this.xlabels[i]; + el.parentNode.removeChild(el); } for (var i = 0; i < this.ylabels.length; i++) { - MochiKit.DOM.removeElement(this.ylabels[i]); + var el = this.ylabels[i]; + el.parentNode.removeChild(el); } this.xlabels = new Array(); this.ylabels = new Array(); @@ -254,9 +257,9 @@ DygraphCanvasRenderer.isSupported = function(canvasName) { var canvas = null; try { if (MochiKit.Base.isUndefinedOrNull(canvasName)) - canvas = MochiKit.DOM.CANVAS({}); + canvas = document.createElement("canvas"); else - canvas = MochiKit.DOM.getElement(canvasName); + canvas = canvasName; var context = canvas.getContext("2d"); } catch (e) { @@ -361,7 +364,7 @@ DygraphCanvasRenderer.prototype._renderAxis = function() { label.style.left = "0px"; label.style.textAlign = "right"; label.style.width = this.options.yAxisLabelWidth + "px"; - MochiKit.DOM.appendChildNodes(this.container, label); + this.container.appendChild(label); this.ylabels.push(label); } @@ -414,7 +417,7 @@ DygraphCanvasRenderer.prototype._renderAxis = function() { label.style.left = left + "px"; label.style.width = this.options.xAxisLabelWidth + "px"; - MochiKit.DOM.appendChildNodes(this.container, label); + this.container.appendChild(label); this.xlabels.push(label); } }