Jorge Campos
Jorge Campos

Reputation: 23381

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:

enter image description here

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.

Upvotes: 1

Views: 2366

Answers (1)

Jorge Campos
Jorge Campos

Reputation: 23381

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:

enter image description here

Upvotes: 2

Related Questions