2014-02-19 4 views
0

barChart에 문제가 있습니다. Primeface에서 barCharts에 대한 예제를 작성했지만 페이지에는 볼 수 없습니다. 다음은 Bean 클래스 PrimeFaces 막대 차트가 표시되지 않습니다.

: 여기

import java.io.Serializable; 
import javax.faces.bean.ManagedBean; 
import javax.faces.bean.ViewScoped; 
import org.primefaces.model.chart.CartesianChartModel; 
import org.primefaces.model.chart.ChartSeries; 

@ManagedBean 
@ViewScoped 

public class InvoiceStatisticsBean implements Serializable { 
private CartesianChartModel categoryModel; 

public InvoiceStatisticsBean() { 
    categoryModel = new CartesianChartModel(); 

    ChartSeries boys = new ChartSeries(); 
    boys.setLabel("Boys"); 

    boys.set("2004", 120); 
    boys.set("2005", 100); 
    boys.set("2006", 44); 
    boys.set("2007", 150); 
    boys.set("2008", 25); 

    ChartSeries girls = new ChartSeries(); 
    girls.setLabel("Girls"); 

    girls.set("2004", 52); 
    girls.set("2005", 60); 
    girls.set("2006", 110); 
    girls.set("2007", 135); 
    girls.set("2008", 120); 

    categoryModel.addSeries(boys); 
    categoryModel.addSeries(girls); 
} 

public CartesianChartModel getCategoryModel() { 
    return categoryModel; 
} 

public void setCategoryModel(CartesianChartModel categoryModel) { 
    this.categoryModel = categoryModel; 
} 
} 

그리고는 .xhtml 파일 : 나쁜 편집 죄송합니다

<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml" 
     xmlns:h="http://xmlns.jcp.org/jsf/html" 
     xmlns:ui="http://xmlns.jcp.org/jsf/facelets" 
     xmlns:p="http://primefaces.org/ui"> 
    <h:head> 
     <title>Invoice Statistics</title> 
    </h:head> 
    <h:body> 
     <ui:composition template="/templates/layout.xhtml"> 
      <ui:define name="header"> 
       <h1>Invoice Statistics</h1> 
      </ui:define> 

     <ui:define name="content"> 
      <p>There should be a barChart</p> 
      <p:barChart id="horizontal" value="#{invoiceStatisticsBean.categoryModel}" legendPosition="se" style="height:300px" title="Horizontal Bar Chart" orientation="horizontal" min="0" max="200"/> 
      <p:outputPanel>test</p:outputPanel> 
     </ui:define> 
    </ui:composition> 
</h:body> 
</html> 

하지만 여기 내 첫 번째 질문입니다.

그렇다면 .xhtml 페이지를 시작하면 barChart의 공간이 페이지에 예약되어 있지만 아무 것도 표시되지 않습니다.

누구든지이 문제로 제발 도와 줄 수 있습니까?

답변

0

ok primefaces 4.0이 문제였습니다. 당신이이 줄을 추가해야하므로 jQuery를 사용하여 템플릿을 사용하는 경우 패널

1
<p:panel> 
     <p:chart ......> 
</p:panel> 

3.5에서 하나 primefaces 4.0에서 jquery.js 파일을 스왑

$ .noConflict();
0

:

는 쪽을 수정해야한다고

+0

관련 문제