-Dygraph.Circles = {
- DEFAULT : function(g, name, ctx, canvasx, canvasy, color, radius) {
- ctx.beginPath();
- ctx.fillStyle = color;
- ctx.arc(canvasx, canvasy, radius, 0, 2 * Math.PI, false);
- ctx.fill();
- },
- TRIANGLE : function(g, name, ctx, cx, cy, color, radius) {
- Dygraph.DrawPolygon_(3, Math.PI / 3, ctx, cx, cy, color, radius);
- },
- SQUARE : function(g, name, ctx, cx, cy, color, radius) {
- Dygraph.DrawPolygon_(4, Math.PI / 4, ctx, cx, cy, color, radius);
- },
- DIAMOND : function(g, name, ctx, cx, cy, color, radius) {
- Dygraph.DrawPolygon_(4, Math.PI / 4, ctx, cx, cy, color, radius, Math.PI / 8);
- },
- PENTAGON : function(g, name, ctx, cx, cy, color, radius) {
- Dygraph.DrawPolygon_(5, Math.PI / 5, ctx, cx, cy, color, radius);
- },
- HEXAGON : function(g, name, ctx, cx, cy, color, radius) {
- Dygraph.DrawPolygon_(6, Math.PI / 6, ctx, cx, cy, color, radius);
- },
- CIRCLE : function(g, name, ctx, cx, cy, color, radius) {
- ctx.beginPath();
- ctx.lineStyle = color;
- ctx.arc(cx, cy, radius, 0, 2 * Math.PI, false);
- ctx.fill();
- },
- STAR : function(g, name, ctx, cx, cy, color, radius) {
- Dygraph.DrawPolygon_(5, 2 * Math.PI / 5, ctx, cx, cy, color, radius);
+/**
+ * Checks whether the browser supports the <canvas> tag.
+ * @param {HTMLCanvasElement=} opt_canvasElement Pass a canvas element as an
+ * optimization if you have one.
+ * @return {boolean} Whether the browser supports canvas.
+ */
+Dygraph.isCanvasSupported = function(opt_canvasElement) {
+ var canvas;
+ try {
+ canvas = opt_canvasElement || document.createElement("canvas");
+ canvas.getContext("2d");
+ }
+ catch (e) {
+ var ie = navigator.appVersion.match(/MSIE (\d\.\d)/);
+ var opera = (navigator.userAgent.toLowerCase().indexOf("opera") != -1);
+ if ((!ie) || (ie[1] < 6) || (opera))
+ return false;
+ return true;