Exporting charts as images
PrimeFaces provides the ability to export charts generated by various chart components as images using the client-side API method widgetVar.exportAsImage()
.
<h:form id="form1"> <p:lineChart widgetVar="chartWgt" value="#{chartController.chartModel}" style="width:500px;height:300px" title="Linear Chart" legendPosition="e" minY="0" maxY="600"/> <p:commandButton type="button" value="Export" onclick="exportChart()"/> <p:dialog widgetVar="dlg" showEffect="fade" modal="true" header="Chart as an Image"> <p:outputPanel id="output" layout="block" style="width:500px;height:300px"/> </p:dialog> </h:form> <script type="text/javascript"> function exportChart() { $(PrimeFaces.escapeClientId...