我试图在我的项目中使用条形图,我想在点击按钮时创建条形图。这是我的bean代码:
@ManagedBean (name="CME24Summ")
@ViewScoped
public class CMESummRep implements Serializable {
private Global glb = _common.findBean("_global", Global.class);
private List<CME24_Summ> InfoList = new ArrayList<CME24_Summ>();
private String SQL;
private String searchLoc = "-";
List<Location> listLoc = new ArrayList<Location>();
private CartesianChartModel categoryModel = new CartesianChartModel();
private Date endingDate, startingDate;
List<Object> whereValues = new ArrayList<Object>();
private CartesianChartModel categoryModel = new CartesianChartModel();
public CMESummRep() {InitialzeLists();}
private void createCategoryModel() {
System.out.println("CHART CLASS");
categoryModel = new CartesianChartModel();
ChartSeries resolved = new ChartSeries();
resolved.setLabel("Resolved");
resolved.set("ABCD", 20);
categoryModel.addSeries(resolved);
}
public void FillListRecords() {
createCategoryModel();
}
public CartesianChartModel getCategoryModel() {
return categoryModel;
}
public void setCategoryModel(CartesianChartModel categoryModel) {
this.categoryModel = categoryModel;
}
}
这是我的HTML代码:
<p:commandButton action="#{CME24Summ.FillListRecords}"
value="Show Data"
update="panelDataList"
process="@this,panelMain"
ajax="true"/>
<p:panelGrid style="width:100%" id="panelDataList">
<p:row>
<p:column>
<h:outputText value="CHART" />
<p:barChart id="basic"
value="#{CME24Summ.categoryModel}"
legendPosition="ne"
title="Basic Bar Chart"
min="0"
max="200"
style="height:300px"/>
</p:column>
</p:row>
</p:panelGrid>
现在,点击显示数据后,我的图表应该被创建并显示在网格上。但相反,没有出现任何内容而不是文字&#34; CHART&#34;。我做错了什么?