O'Reilly logo

PrimeFaces Beginner's Guide by K. Siva Prasad Reddy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a Pie chart

The Pie chart component renders the category data as a Pie chart. The Pie chart uses the org.primefaces.model.chart.PieChartModel type instance as a backing bean model.

Let us see how we can create a Pie chart representing the percentage of posts being created with various tags:

<p:pieChart value="#{chartController.pieChartModel}" style="width: 350px; height: 250px;" showDataLabels="true" legendPosition="ne"/> public class ChartController { private PieChartModel pieChartModel; public ChartController() { pieChartModel = new PieChartModel(); pieChartModel.set("JSF", 380); pieChartModel.set("PrimeFaces", 455); pieChartModel.set("jQuery", 202); pieChartModel.set("JPA", 180); } public PieChartModel getPieChartModel() { return pieChartModel; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required