我在 WebSphere Application Srever 8 上使用 Primefaces 3.4 和 Apache MyFaces 2.1.8。
我有一些图表。现在我想让将图表另存为图像成为可能。 PF自带图表导出功能。
在 PF 展示中,他们在新对话框中导出图像: look here
我想在按下按钮时获得典型的“另存为”对话框。
有人可以提示我如何为此编写 javascript 吗?
是这样的:
<script type="text/javascript">
//
function exportChart() {
//export image
$('#chart').exportAsImage();
}
//
</script>
最好的问候
最佳答案
我来晚了,但希望它能帮助其他人解决问题。
确保“chart”和“dlg”是 javascript 变量
<script type="text/javascript">
//
function exportChart() {
//export image
$('#output').empty().append(chart.exportAsImage());
//show the dialog
dlg.show();
}
//
</script>
关于java - "Save primefaces chart as"带导出功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12318082/