简体   繁体   中英

Primefaces Pie chart legend overflows graph area

I'm using Primefaces 5.1 and JSF 2.2.4. On my application I have a functionality that renders a graph based on a result of a search. The problem is when the search returns many itens my graph legend overflows the graph area here is the image:

在此处输入图片说明

I've looked into the documentation and couldn't find anything about the legend size or something else that could solve my problem.

There is nothing wrong with the code so I think that there is no need to add it. If you think otherwise please tell me.

I finally solve my problem. I had to upgrade the primefaces version to 5.2 (I was using 5.1) and since this version there are new attributes do be setted on managed bean.

What I did to the legend work properly as I wanted was two things:

On the managed bean method that process the graph I added the line:

chartModel.setLegendCols(4);

And on the xhtml file I increased the graph size adding the style attribute size:

 <p:chart type="pie" 
          model="#{chartMBean.chartModel}"
          style="width:1200px; height:600px"/>

And voila:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM