this.element = element;
this.container = this.element.parentNode;
- // Stuff relating to Canvas on IE support
- this.isIE = (/MSIE/.test(navigator.userAgent) && !window.opera);
-
- if (this.isIE && !isNil(G_vmlCanvasManager)) {
- this.IEDelay = 0.5;
- this.maxTries = 5;
- this.renderDelay = null;
- this.clearDelay = null;
- this.element = G_vmlCanvasManager.initElement(this.element);
- }
-
this.height = this.element.height;
this.width = this.element.width;
if (drawPoints || isIsolated) {
ctx.beginPath();
ctx.fillStyle = color;
- ctx.arc(point.canvasx, point.canvasy, pointSize, 0, 360, false);
+ ctx.arc(point.canvasx, point.canvasy, pointSize,
+ 0, 2 * Math.PI, false);
ctx.fill();
}
}
enclosing.appendChild(this.graphDiv);
// Create the canvas for interactive parts of the chart.
- this.canvas_ = document.createElement("canvas");
+ // this.canvas_ = document.createElement("canvas");
+ this.canvas_ = Dygraph.createCanvas();
this.canvas_.style.position = "absolute";
this.canvas_.width = this.width_;
this.canvas_.height = this.height_;
+ this.canvas_.style.width = this.width_ + "px"; // for IE
+ this.canvas_.style.height = this.height_ + "px"; // for IE
this.graphDiv.appendChild(this.canvas_);
// ... and for static parts of the chart.
* @private
*/
Dygraph.prototype.createPlotKitCanvas_ = function(canvas) {
- var h = document.createElement("canvas");
+ // var h = document.createElement("canvas");
+ var h = Dygraph.createCanvas();
h.style.position = "absolute";
h.style.top = canvas.style.top;
h.style.left = canvas.style.left;
h.width = this.width_;
h.height = this.height_;
+ h.style.width = this.width_ + "px"; // for IE
+ h.style.height = this.height_ + "px"; // for IE
this.graphDiv.appendChild(h);
return h;
};
ctx.beginPath();
ctx.fillStyle = this.colors_[i%clen];
ctx.arc(canvasx, this.selPoints_[i%clen].canvasy, circleSize,
- 0, 360, false);
+ 0, 2 * Math.PI, false);
ctx.fill();
}
ctx.restore();
this.drawGraph_(this.rawData_);
};
+/**
+ * Create a new canvas element. This is more complex than a simple
+ * document.createElement("canvas") because of IE and excanvas.
+ */
+Dygraph.createCanvas = function() {
+ var canvas = document.createElement("canvas");
+
+ isIE = (/MSIE/.test(navigator.userAgent) && !window.opera);
+ if (isIE) {
+ canvas = G_vmlCanvasManager.initElement(canvas);
+ }
+
+ return canvas;
+};
+
/**
* A wrapper around Dygraph that implements the gviz API.