I am trying to print charts (JSChart) in a pdf using jsPDF. It seems like the chart image is created while the chart is not rendered completely (the data points are still on the bottom of the chart).
var ssvCanvas = document.querySelector('#line-chart-ssv');
var ssvCanvasImg = ssvCanvas.toDataURL("image/png", 1.0);
var doc = new jsPDF();
var ssvImgProps = doc.getImageProperties(ssvCanvasImg);
var width = doc.internal.pageSize.getWidth()-20;
var ssvHeight = (ssvImgProps.height * width) / ssvImgProps.width;
doc.addImage(ssvCanvasImg, 'JPEG', 10, 40, width, ssvHeight );
I have no idea what could help. A wait function wasnt useful as of now. Can somebody please help?