Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Arenhill committed Dec 13, 2018
1 parent c11283b commit 5e16f27
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions src/appCommons/chartHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@

export const addDownloadChartAsImageHandler = function(chartContainer, filenamePrefix) {

var button = document.createElement("a");
button.className = "download-button btn btn-default";
button.innerText = i18next.t("Download as image");
var button = document.createElement("a");
button.className = "download-button btn btn-default";
button.innerText = i18next.t("Download as image");

var canvas = chartContainer.querySelector("canvas");
canvas.parentNode.insertBefore(button, canvas);
//<a href='#' class='download-button btn btn-default'>{{\'Download as image\' | i18next}}</a>
button.onclick = function(){
var dataURL = canvas.toDataURL('image/png');
var now = new Date();
button.download = filenamePrefix + "_" + now.getFullYear() + "_" + (now.getMonth()+1) + "_" + now.getDate() + ".png";
button.href = dataURL;
}
}
var canvas = chartContainer.querySelector("canvas");
canvas.parentNode.insertBefore(button, canvas);
//<a href='#' class='download-button btn btn-default'>{{\'Download as image\' | i18next}}</a>
button.onclick = function(){
var dataURL = canvas.toDataURL("image/png");
var now = new Date();
button.download = filenamePrefix + "_" + now.getFullYear() + "_" + (now.getMonth()+1) + "_" + now.getDate() + ".png";
button.href = dataURL;
};
};
2 changes: 1 addition & 1 deletion src/libs/prototypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ var resultHandler = function (functionToCall, extraParameter, includeData) {
};
if (!Array.prototype.move) {
Array.prototype.move = function(from, to) {
this.splice(to, 0, this.splice(from, 1)[0]);
this.splice(to, 0, this.splice(from, 1)[0]);
};
}

0 comments on commit 5e16f27

Please sign in to comment.