- $("canvas").each(function() {
- var image = new Image();
-
- window.open(this.toDataURL("image/png"));
- $("#graph-controls").append(image);
- });
+ html2canvas($("#graph-widget")[0], {
+ onrendered: function(canvas) {
+ var context = canvas.getContext('2d');
+ context.webkitImageSmoothingEnabled = false;//webkit
+ context.mozImageSmoothingEnabled = false;//firefox
+ context.imageSmoothingEnabled = false;
+
+ window.open(canvas.toDataURL("image/png"));
+
+ /*
+ var canvasOut = document.createElement("canvas");
+ var ratio = canvas.height / canvas.width;
+ var width = 1600;
+ var height = width * ratio;
+ canvasOut.setAttribute('width', width);
+ canvasOut.setAttribute('height', height);
+
+ context = canvasOut.getContext('2d');
+ context.webkitImageSmoothingEnabled = false;//webkit
+ context.mozImageSmoothingEnabled = false;//firefox
+ context.imageSmoothingEnabled = false;
+ context.drawImage(canvas, 0, 0, canvas.width, canvas.height, 0, 0, width, height);
+
+ window.open(canvasOut.toDataURL("image/png"))*/
+ }
+ });