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

Time for action – creating a Pie chart

In this section we are going to create a Pie chart with various customization options, such as diameter, sliceMargin, and dataFormat showing the total number of posts that are posted with each tag.

  1. Create a Pie chart without filling the slices with colors, gaps between slices, and displaying the slice data value instead of the percentage.
    <p:pieChart value="#{chartController.pieChartModel}"
      style="width: 350px; height: 250px;"
      title="Post Statistics By Tag"legendPosition="ne" 
      legendCols="2"
      showDataLabels="true"
      diameter="150"
      sliceMargin="5"
      fill="false"
      dataFormat="value"/>

What just happened?

We have created a Pie chart by disabling the color filling for slices by setting fill= "false". By setting the dataFormat= ...

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