PieSetCollectorFunction

Description

To generate pie charts in JFreeChart, we need to create a JFreeChart dataset of type DefaultPieDataset. The PieSetCollectorFunction is designed so that you can tell it a little about the data columns, and it will collect the data necessary to build a DefaultPieDataset which can then be handed to JFreeChart for plotting. Here are the properties for this collector. Pie datasets require two and only two dimensions (columns) - one for the pie piece names (the series) and one for the values that are used to calculate size of each pie piece.

Chart types that work with PieSetCollectorFunction

There are two chart types that work with Pie datasets. The Pie Chart (PieChartExpression) and the RingChartExpression. For details on what each of these charts look like, please see the JFreeChart web site.

Property Details

Property Name

Data Type

Description

seriesColumn

String

This is the name of the column in the data set that contains all the series names. For example, if creating a pie chart containing one pie slice for each region, then the seriesColumn would be the column containing region names.

valueColumn

String

This is the name of the column in the data set that contains the numbers that will be accumulated for each series. In other words, this is the column containing the numbers for the pie chart.

group (optional)

String

This provides the name of the group that the chart is appearing in. If the chart is for detail information, then this is not necessary. This is used in only in conjunction with summaryOnly (see below). When group is specified, then the data will only be gathered when the group is finished in the report (groupFinished event). When the specified group is finished, and when summaryOnly is true, then the data values are gathered from the seriesColumn and valueColumn. So, this assumes that the grouping is on the seriesColumn.

summaryOnly

Boolean (true or false only)

If summaryOnly is true, then when the items advance, no action is taken to accumulate data. This should only be used with a group specified so that when the groups advance, the data can be properly accumulated.

resetGroup (optional)

String

The resetGroup specifies a group that will be used to create charts within a sub-group. For example, if charting one chart per region, and the chart is displaying data for departments within a region, the resetGroup would be set to the region group, and the chart group would be set to department group. For an example, see the JFreeReport_Chart_Pie.xml.