Primefaces:chart 未显示在 ajax 动态创建中

Primefaces:chart doesn't show up on ajax dynamic creation

我有一个问题,图表在更新时不显示,但如果我刷新页面它就会显示。

  <p:panel id="main">
      <p:commandbutton action="Somebeckbean"> 
      <p:panel id="something">
           <p:datatable rendered="#{mainController.tableRender}">   
           </p:datatable> 
      </p:panel>
      <p:panel id="keywordsBar">          
          <p:chart  type="bar"  rendered="#{mainController.keywordsBar}"
          model="#{mainController.horizontalBarModel}" style="height:300px;width:100%;" styleClass="center"/>   

      </p:panel>  
 </p:panel>

当我单击按钮时,我填充数据 table 和条形图,我将渲染设置为 true 并更新主面板。

我的数据table 得到渲染并显示,但条形图未显示,它渲染到此。

</div>
     <script id="mainForm:j_idt109_s" type="text/javascript">
     $(function(){
         PrimeFaces.cw('Chart','widget_mainForm_j_idt109' {id:'mainForm:j_idt109',type:'bar',data:[[[9,1],[2,2],[2,3],[1,4],[1,5],[1,6],[1,7],[1,8],[1,9],[1,10],[1,11],[1,12],[1,13],[1,14],[1,15]]],title:"Keyword's occurrences",legendPosition:"e",axes:{xaxis: {label:"Occurrences",min:0,max:10,renderer:$.jqplot.LinearAxisRenderer,tickOptions:{angle:"0"}},yaxis: {label:"Keywords",renderer:$.jqplot.CategoryAxisRenderer,tickOptions:{angle:"0"}}},series:[{label:'null'}],ticks:["","Croatia","Zagreb","Accommodations","Attractions","Car Hire","Flights","Hotels","Hrvatska","News","Travel information","Zagreb City News","Zagreb Hotels","cities","city"],orientation:"horizontal",stackSeries:true,datatip:true},'charts');});
    </script>
</div>

我发现了这个错误:

Uncaught TypeError: Cannot read property 'LinearAxisRenderer' of undefined(anonymous function) @ (program):1bI.Callbacks.i @

如果我刷新页面,会显示栏。 谢谢

我找到了解决方案here

primefaces官方对此问题的回应

只需在页面中添加这些行。

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