0
When the chart is loaded, the caption loads along, but when I download the image the caption does not appear..
Button to download:
<p:commandLink onclick="return downloadImage();"
style="margin: 2%;">
<h:graphicImage url="/RESOURCES/icons/grafico/download.png"
styleClass="ui-image-icon-excel" style=" margin-top: 5%;" />
</p:commandLink>
Javascript from download button:
[![<script type="application/javascript">
function downloadImage(){
var image = PF('chart').exportAsImage();
var imageSrc = $(image).attr('src');
var url = imageSrc.replace(/^data:image\/\[^;\]+/, 'data:application/octet-stream');
var link = document.createElement('a');
link.download = "chart.png";
link.href = url;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
return false;
}
</script>][1]][1]