我无法将素数面图导出为图像。
categoryModel
与 Prime-show Case 相同。
是否需要依赖库才能导出?
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
......
template="/common/commonLayout.xhtml">
<ui:define name="content">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript">
//<![CDATA[
function exportChart() {
//export image
$('#output').empty().append(chart.exportAsImage());
//show the dialog
dlg.show();
}
//]]>
</script>
<h:form enctype="multipart/form-data">
<p:barChart id="basic" value="#{ChartActionBean.categoryModel}" legendPosition="ne"
title="Bar Chart" widgetVar="chart" animate="true" yaxisLabel="Number of Count"/>
<p:commandButton type="button" value="Export" icon="ui-icon-extlink" 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>
</ui:define>
</ui:composition>