我有一个问题,图表没有显示更新,但它显示我刷新页面。
<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>
当我点击按钮i填充数据表和条形图时,我将渲染设置为true并更新主面板。
我的数据表被渲染并且显示出来但是条形图没有显示出来并且它呈现给它。
</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:无法读取未定义(匿名函数)@(程序)的属性'LinearAxisRenderer':1bI.Callbacks.i @
如果我刷新页面,则会显示条形图。 THX
答案 0 :(得分:2)
我找到了解决方案here
这是这个问题的官方回应。
只需在页面中添加这些行。
<h:outputScript name="charts/charts.js" library="primefaces" />
<h:outputStylesheet name="charts/charts.css" library="primefaces" />