Home Forums Chart Support Export function Reply To: Export function

#42580

@nerviozzo96,

CanvasJS supports exporting chart as an image or to print it. To export chart rendered within a page along with table, you can use html2canvas & jsPDF as shown in the code-snippet below.

html2canvas(document.querySelector("#container")).then(canvas => {  
  var dataURL = canvas.toDataURL();
  var pdf = new jsPDF();
  pdf.addImage(dataURL, 'JPEG', 20, 20, 170, 120); //addImage(image, format, x-coordinate, y-coordinate, width, height)
  pdf.save("Chart with Table.pdf");
});

Please take a look at this JSFiddle for a working example.


Vishwas R
Team CanvasJS