Home Forums Chart Support multiple charts with dynamic id using angularjs ng-repeat Reply To: multiple charts with dynamic id using angularjs ng-repeat

#23982

@subhashe,

chart.print() is only available for the specific chart on which it is called. You can call chart.print() on individual charts separately or you can use a third party plugin html2canvas to capture a combined image of the available charts and print it using window.print(). Please refer the below code –

$("#exportButton").click(function(){
  html2canvas(document.querySelector("#chartsContainer")).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("CanvasJS Charts.pdf");
  });
});

Also, kindly check this JSFiddle to combine multiple charts using html2canvas.

exporting multiple charts using html2canvas

___________
Indranil Deo
Team CanvasJS