[英]PrimeFaces Extensions Gchart is not working properly
I am using PrimeFaces version 6.1.我正在使用 PrimeFaces 版本 6.1。 I need to show my data in chart format.我需要以图表格式显示我的数据。 For this i implemented the GChart component as link https://www.primefaces.org/showcase-ext/sections/gchart/basic.jsf .为此,我将 GChart 组件实现为链接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:我在控制台中搜索错误,出现如下错误:
I need to refresh the page in order to get my page in working condition.我需要刷新页面才能使我的页面处于工作状态。 I tried by giving id for pe:gChart tag and when i click on a link chart appears and on next click page goes blank and error appears as the container with new given id is not defined.我尝试通过为 pe:gChart 标记提供 id,当我单击链接图表时出现,并且在下一次单击页面上变为空白,并且由于未定义具有新给定 id 的容器而出现错误。 My view code is like this:我的视图代码是这样的:
<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>
My managed bean code is like this:我的托管 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();
}
You have a version mismatch.您的版本不匹配。 You are using PrimeFaces 6.1 but only using PrimeFaces Extensions 6.0.0.您正在使用 PrimeFaces 6.1,但仅使用 PrimeFaces Extensions 6.0.0。 You PF and PFE versions must always match.您的 PF 和 PFE 版本必须始终匹配。
You can read the release notes guide to find out which version always lines up: https://github.com/primefaces-extensions/primefaces-extensions.github.com/wiki/Release-Notes您可以阅读发行说明指南以找出始终排列的版本: https://github.com/primefaces-extensions/primefaces-extensions.github.com/wiki/Release-Notes
So by upgrading to PFE 6.1.1 that will match your version and fix your issues.因此,通过升级到与您的版本匹配并解决您的问题的 PFE 6.1.1。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.