Primefaces Pie chart legend overflows graph area

UI Components for JSF
Post Reply
Jorge
Posts: 25
Joined: 21 Sep 2011, 14:00

19 Jun 2015, 13:53

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:

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 guys think otherwise please tell me.

Thanks in advance.
Jorge Campos
--
Eclipse Juno
Primefaces 6.1.RC3
JSF 2.2.8
Apache Tomcat 8.5.14

Jorge
Posts: 25
Joined: 21 Sep 2011, 14:00

02 Jul 2015, 20:40

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:

Code: Select all

    chartModel.setLegendCols(4);
And on the xhtml file I increased the graph size adding the style attribute size:

Code: Select all

     <p:chart type="pie" 
              model="#{chartMBean.chartModel}"
              style="width:1200px; height:600px"/>
And voila:
Image
Jorge Campos
--
Eclipse Juno
Primefaces 6.1.RC3
JSF 2.2.8
Apache Tomcat 8.5.14

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 35 guests