データベースからチャート素数にデータを入れたいです。さまざまな方法で試してみましたが、結果はありません。この簡単な方法を試してみましたが、何も表示されません: ManagedBean:
public class ChartBean implements Serializable{
private List < ChartContentBean > chartContentbeanList;
public ChartBean() {
chartContentbeanList = new ArrayList < ChartContentBean > ();
chartContentbeanList.add(new ChartContentBean(2006, 25, 20));
chartContentbeanList.add(new ChartContentBean(2007, 60, 50));
chartContentbeanList.add(new ChartContentBean(2008, 40, 65));
chartContentbeanList.add(new ChartContentBean(2009, 70, 60));
}
public List < ChartContentBean > getChartContentbeanList() {
return chartContentbeanList;
}
}
ChartContentBean.xhtml
public class ChartContentBean{
private int year;
private int passPercentage;
private int failedPercentage;
public ChartContentBean() {}
public ChartContentBean(int year, int passPercentage, int failedPercentage) {
this.year = year;
this.passPercentage = passPercentage;
this.failedPercentage = failedPercentage;
}
//get and set
}
chart.xhtml
<xmlns:p="http://primefaces.prime.com.tr/ui">
<h:form>
<p:lineChart value="#{chartBean.chartContentbeanList}" var="chartContentBean" xfield="#{chartContentBean.year}">
<p:chartSeries label="Class A"
value="#{chartContentBean.passPercentage}" />
<p:chartSeries label="Class B"
value="#{chartContentBean.failedPercentage}" />
</p:lineChart>
</h:form>