未捕获的TypeError:无法读取属性' LinearAxisRenderer'未定义的

时间:2015-07-28 10:09:56

标签: javascript jsf-2 primefaces linechart

我尝试将<p:chart>LineChartModel一起使用,但是当我加载页面时,没有显示任何内容并且存在JS错误。

这是我的模特

@ManagedBean
@SessionScoped
public class InterfaceBean {

   private LineChartModel   model                   = new LineChartModel();

   @PostConstruct
   public void init()
   {
      this.drawInterfaceChart();
   }
   public void drawInterfaceChart(){

      model = initLineChartModel();
      model.setTitle("toto");
      model.setAnimate(true);
      model.setLegendPosition("se");
      Axis yAxis = model.getAxis(AxisType.Y);
      yAxis.setMin(0);
      yAxis.setMax(100);
   }


   private LineChartModel initLineChartModel(){
      LineChartModel model   = new LineChartModel();
      LineChartSeries series = new LineChartSeries();

      int limit = (listExecution.size() > 10) ? 10 : listExecution.size();

      for (int i=0; i<limit; i++) 
      {
        series.set("execution "+i, listExecution.get(i).getSuccessRate());
      }

      model.addSeries(series);
      return model;
   }

}

这是我的观点

<h:panelGrid columns="2" columnClasses="left,right" style="width:100%">
    <p:chart type="line" rendered="true" model="#{interfaceBean.model}" style="width:400px;" />
</h:panelGrid>

这是JS错误

  

未捕获的TypeError:无法读取属性&#39; LinearAxisRenderer&#39;未定义的

在阅读了很多关于此类问题的主题后,我在网页上添加了这个

<h:outputStylesheet name="charts/charts.css" library="primefaces" />
<h:outputScript name="charts/charts.js" library="primefaces" />

但我仍然遇到相同的JavaScript错误,并且始终不显示lineChart

这是如何引起的?如何解决?

0 个答案:

没有答案
相关问题