Jsf 当图表位于数据表中时,如何导出图表?Primefaces 3.4

Jsf 当图表位于数据表中时,如何导出图表?Primefaces 3.4,jsf,primefaces,charts,datatable,export,Jsf,Primefaces,Charts,Datatable,Export,这个主意是什么 将图形保存在图像中 将二进制文件传递给服务器上的字符串 从二进制文件中识别图形(就绪) 创建包含数据和图形的pdf(准备就绪,使用itex) 查看pdf(就绪) 但我不能输出任何图形。这是因为我无法发现它们。 当我在datatable中包含一个图形时,widgetvar会重复,因此我无法使用的解决方案 这是我代码的一部分 <h:form id="reportePro"> <p:dataTable value="#{listas.reporteSeccionPro

这个主意是什么

  • 将图形保存在图像中
  • 将二进制文件传递给服务器上的字符串
  • 从二进制文件中识别图形(就绪)
  • 创建包含数据和图形的pdf(准备就绪,使用itex)
  • 查看pdf(就绪)
  • 但我不能输出任何图形。这是因为我无法发现它们。 当我在datatable中包含一个图形时,widgetvar会重复,因此我无法使用的解决方案

    这是我代码的一部分

    <h:form id="reportePro">
    <p:dataTable value="#{listas.reporteSeccionPro}" var="p"
          selection="#{listas.reporteSeleccionadoSeccionPro}"
          selectionMode="single" rowKey="#{p.idFila}"
          emptyMessage="No existen coincidencias" id="reporteGeneral">
          <p:column headerText="Chart">
             <p:commandButton id="chartBtn" value="Gráficos" type="button" />
             <p:overlayPanel id="chartPanel" for="chartBtn" hideEffect="fade"
                showEffect="fade" appendToBody="true"
                style="width:900px;height:450px;">
                <p:pieChart id="pie" 
                   styleClass="jqplot-table-legend jqplot-target"
                   value="#{p.pieModel}" extender="ext"
                   title="#{p.nomProSeccionPro}"
                   style="width:400px;height:450px;font-size:15px;"
                   showDataLabels="true" sliceMargin="5"
                   seriesColors="DB4C14, C0E9ED, A8CCED, C7B47F, F7F28F, 4DB0C4" />
             </p:overlayPanel>
          </p:column>
       </p:dataTable>
    </h:form>
    
    但请记住,您不能使用动态id

    另一个解决方案可能是使用canvas.toDataURL,为此,我需要第一个画布的id,但不生成primefaces id。 所以我不能使用这个解决方案

    在花了几个小时没有找到解决办法后,我问我。 当图表位于数据表中时,是否可以将其导出到图像

    <h:form id="reportePro">
    <p:dataTable value="#{listas.reporteSeccionPro}" var="p"
          selection="#{listas.reporteSeleccionadoSeccionPro}"
          selectionMode="single" rowKey="#{p.idFila}"
          emptyMessage="No existen coincidencias" id="reporteGeneral">
          <p:column headerText="Chart">
             <p:commandButton id="chartBtn" value="Gráficos" type="button" />
             <p:overlayPanel id="chartPanel" for="chartBtn" hideEffect="fade"
                showEffect="fade" appendToBody="true"
                style="width:900px;height:450px;">
                <p:pieChart id="pie" 
                   styleClass="jqplot-table-legend jqplot-target"
                   value="#{p.pieModel}" extender="ext"
                   title="#{p.nomProSeccionPro}"
                   style="width:400px;height:450px;font-size:15px;"
                   showDataLabels="true" sliceMargin="5"
                   seriesColors="DB4C14, C0E9ED, A8CCED, C7B47F, F7F28F, 4DB0C4" />
             </p:overlayPanel>
          </p:column>
       </p:dataTable>
    </h:form>
    
    <p:pieChart id="#{chart.idPie}"  />
    
    <p:pieChart widgetvar="#{chart.idPie}"  />
    
    #{p:widgetVar ('ComponentId')}