jquery - Print of chart generated using c3js -


need way take print of chart generated using c3js.

i tried below code:

 var mywindow = window.open('', 'my div', 'height=400,width=600');     mywindow.document.write('<html><head><title>my div</title>');             //mywindow.document.write('<link rel="stylesheet" href="~/content/c3.css" type="text/css" />');           mywindow.document.write('</head><body>');     mywindow.document.write($('#chart').html());     mywindow.document.write('</body></html>');      mywindow.document.close(); // necessary ie >= 10     mywindow.focus(); // necessary ie >= 10      mywindow.print();     mywindow.close(); 

but gives me improper chart enter link description here

in example inclusion of c3.css file uncommented, why that? seems it's css that's missing.

and should try call window.print() when window opened finished loading. achieve calling window.print() in body's onload event.

<body onload="window.print()"> 

another thing helped little timeout :), that's not preferred solution.

<body onload="settimeout(function() {window.print();}, 2000);"> 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -