Skip to content Skip to sidebar Skip to footer

Render Chartjs On Hidden Div

I'm trying to render many charts using chart.js on a hidden div, then convert them to images to use in a PDF report. My problem is: if the chart is not rendered on the DOM, I can't

Solution 1:

The fastest hack would be to replace:

<divstyle="display: none;">

with

<divstyle="position:absolute;left:-9999px;top:-9999px;">

and it will work: https://jsfiddle.net/FGRibreau/n1cx9d70/2/ :)

PS: If you need to render the chart server-side (e.g. in a batch) in order to then embed it inside PDF reports then you might want to consider dedicated services like Image-Charts.

Post a Comment for "Render Chartjs On Hidden Div"