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.
- 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= "value"
, the slice data value will be displayed instead of the percentage. Also we have specified...