0👍
You can use JavaScript to achieve this:
Working sample: https://stackblitz.com/edit/angular-playground-i6sycz?file=app/hello-framework/hello-framework.component.ts
openChart(){
var canvas = <HTMLCanvasElement>document.getElementById("amplitudeChart");
let canvasClone = this.cloneCanvas(canvas);
console.log(canvasClone)
var myWindow = window.open();
myWindow.document.body.appendChild(canvasClone);
}
cloneCanvas(oldCanvas) {
//create a new canvas
var newCanvas = document.createElement('canvas');
var context = newCanvas.getContext('2d');
//set dimensions
newCanvas.width = oldCanvas.width;
newCanvas.height = oldCanvas.height;
//apply the old canvas to the new one
context.drawImage(oldCanvas, 0, 0);
//return the new canvas
return newCanvas;
}
- Chartjs-Chart js showing some weird data at top of charts
- Chartjs-How to decrease white space of a card containing pie-chart in mobile view
Source:stackexchange.com