forked from primefaces-extensions/primefaces-extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix primefaces-extensions#1451: Apache ECharts add print and export
- Loading branch information
Showing
5 changed files
with
97 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
showcase/src/main/webapp/sections/echarts/example-exportUsage.xhtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<ui:composition | ||
xmlns="http://www.w3.org/1999/xhtml" | ||
xmlns:ui="http://xmlns.jcp.org/jsf/facelets" | ||
xmlns:p="http://primefaces.org/ui" | ||
xmlns:pe="http://primefaces.org/ui/extensions"> | ||
|
||
<p:messages id="messages" showSummary="false" showDetail="true"> | ||
<p:autoUpdate/> | ||
</p:messages> | ||
|
||
<!-- EXAMPLE-SOURCE-START --> | ||
<script> | ||
//<![CDATA[ | ||
function exportChart() { | ||
//export image | ||
$('#output').empty().append(PF('exportEChart').exportAsImage()); | ||
|
||
//show the dialog | ||
PF('dlg').show(); | ||
}; | ||
|
||
//]]> | ||
</script> | ||
|
||
<pe:echart style="width: 50vw; height: 400px;" id="echart" widgetVar="exportEChart" value="#{eChartController.json}"> | ||
<p:ajax event="itemSelect" listener="#{eChartController.itemSelect}" /> | ||
</pe:echart> | ||
|
||
<p:commandButton type="button" value="Export" icon="pi pi-home" onclick="exportChart()" styleClass="mr-2 mb-2"/> | ||
<p:commandButton type="button" value="Print" icon="pi pi-print" onclick="PF('exportEChart').print()" styleClass="mr-2 mb-2"/> | ||
|
||
<p:dialog widgetVar="dlg" showEffect="fade" modal="true" header="Chart as an Image" resizable="false"> | ||
<p:outputPanel id="output" layout="block" style="width: 50vw; height: 400px;"/> | ||
</p:dialog> | ||
<!-- EXAMPLE-SOURCE-END --> | ||
</ui:composition> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,9 +9,9 @@ | |
<p:autoUpdate/> | ||
</p:messages> | ||
|
||
<!-- EXAMPLE-SOURCE-START --> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/vintage.min.js"></script> | ||
|
||
<!-- EXAMPLE-SOURCE-START --> | ||
<pe:echart style="width: 50vw; height: 400px;" widgetVar="themeEChart" theme="vintage"> | ||
<p:ajax event="itemSelect" listener="#{eChartController.itemSelect}" /> | ||
<f:facet name="value"> | ||
|
34 changes: 34 additions & 0 deletions
34
showcase/src/main/webapp/sections/echarts/exportUsage.xhtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<html xmlns="http://www.w3.org/1999/xhtml" | ||
xmlns:h="http://xmlns.jcp.org/jsf/html" | ||
xmlns:f="http://xmlns.jcp.org/jsf/core" | ||
xmlns:ui="http://xmlns.jcp.org/jsf/facelets" | ||
xmlns:showcase="http://primefaces.org/ui/extensions/showcase"> | ||
<ui:composition template="/templates/showcaseLayout.xhtml"> | ||
<ui:define name="centerContent"> | ||
<f:facet name="header"> | ||
<h:outputText value="EChart"/> | ||
</f:facet> | ||
<h:panelGroup layout="block" styleClass="centerContent"> | ||
Apache ECharts can be exported to PNG, JPG, or SVG as well as printed. | ||
</h:panelGroup> | ||
|
||
<h:panelGroup layout="block" styleClass="centerExample"> | ||
<ui:include src="/sections/echarts/example-exportUsage.xhtml"/> | ||
</h:panelGroup> | ||
|
||
<ui:decorate template="/templates/oneTabDecorator.xhtml"> | ||
<ui:define name="contentTab1"> | ||
${showcase:getFileContent('/sections/echarts/example-exportUsage.xhtml')} | ||
</ui:define> | ||
</ui:decorate> | ||
</ui:define> | ||
<ui:define name="useCases"> | ||
<ui:include src="/sections/echarts/useCasesChoice.xhtml"/> | ||
</ui:define> | ||
<ui:define name="docuTable"> | ||
<ui:include src="/sections/shared/documentation.xhtml"> | ||
<ui:param name="tagName" value="echart"/> | ||
</ui:include> | ||
</ui:define> | ||
</ui:composition> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters