How to print a chart using IceFaces/JSF

103 Views Asked by At

How can I make use of downloadAsImage() to download/print the chart in PNG format?

I used exportToChart() as mentioned below but it just displays the chart under the existing chart.

<h:form id="exportForm">
    <h:commandButton id="exportButton" value="Export as Image"
                     onclick="exportChart.exportToImage(ice.ace.jq('.chartExport')); 
                              return false;" />
<ace:chart ...
               widgetVar="exportChart" />
</h:form>
<h:graphicImage styleClass="chartExport" />  

Edit
Tried this:

<ice:commandButton  value="Print" 
        onclick="$('barChart').printElement();" >
        <ace:printer for="barChart"></ace:printer>
</ice:commandButton>  

where barChart is id for the chart. This only prints the legend and numeric values but not actual graph.

0

There are 0 best solutions below