PrimeFaces Extensions Gchart 无法正常工作

PrimeFaces Extensions Gchart is not working properly

我使用的是 PrimeFaces 6.1 版。我需要以图表格式显示我的数据。为此,我将 GChart 组件实现为 link https://www.primefaces.org/showcase-ext/sections/gchart/basic.jsf. I have added link in my form and on click of that link, i have rendered the chart. I need to show different chart in that form. So i have different panels for showing different charts on click of different buttons. when the page loads and on click of a link for first time, chart renders properly. Next time when i click the same link the whole page goes blank. I searched for error in console and error appears as shown below:

我需要刷新页面以使我的页面处于工作状态。我尝试为 pe:gChart 标签提供 id,当我点击 link 图表时出现,在下一次点击页面上变为空白并且出现错误,因为未定义具有新给定 id 的容器。我的视图代码是这样的:

<script src="https://www.gstatic.com/charts/loader.js"></script>
<h:form id="dash">
<p:commandLink id="savButton" class="small-box-footer" action="#{dashboardMB.createPieModel1}" update="@form">
                    <h:outputLabel  styleClass="np" value="#{text.Detail}"/>
                    <i class="fa fa-arrow-circle-right"></i>

</p:commandLink>
<p:panel header="#{text.Saving}"  rendered="#{dashboardMB.savVisible}" id="panelSav" closable="false" toggleable="true" >


            <p:outputPanel id="container1" layout="block">


                <div id="savChart">
                    <pe:gChart value="#{dashboardMB.savingChartModel}" width="400" height="400"
                        title="Saving Wise">

                    </pe:gChart>
                </div>



            </p:outputPanel>


</p:panel>

我的托管bean代码是这样的:

public void  createPieModel1() {  

            isSavVisible=true;
            DashboardModel dashObj=new DashboardModel();
            dashObj=dashBoardEJB.getvalues();
            chartSavingModel = new GChartModelBuilder()
                    .setChartType(GChartType.COLUMN)  
                    .addColumns("Topping", "Slices")
                    .addRow("A", dashObj.getCount1())  
                    .addRow("V", dashObj.getCount2())
                    .addRow("Z", dashObj.getCount3())
                    .addRow("W", dashObj.getCount4())
                    .build();  
  }

您的版本不匹配。您正在使用 PrimeFaces 6.1,但仅使用 PrimeFaces Extensions 6.0.0。您的 PF 和 PFE 版本必须始终匹配。

您可以阅读发行说明指南以找出始终符合哪个版本: https://github.com/primefaces-extensions/primefaces-extensions.github.com/wiki/Release-Notes

因此,升级到 PFE 6.1.1 即可匹配您的版本并解决您的问题。