Java Reference
In-Depth Information
<!-- Start 3D Pie Chart -->
<pie3DChart>
<chart evaluationTime="Report" isShowLegend="false">
<reportElement x="125" y="375" width="300" height="200"/>
</chart>
<pieDataset>
<dataset incrementType="None"/>
<keyExpression>
<![CDATA[$F{model}]]>
</keyExpression>
<valueExpression>
<![CDATA[$V{totalAircraft}]]>
</valueExpression>
</pieDataset>
<pie3DPlot>
<plot/>
</pie3DPlot>
</pie3DChart>
<!-- End 3D Pie Chart -->
</band>
</summary>
</jasperReport>
As we can see from this example, the JRXML element to create a two-dimensional
pie chart is
<pieChart>
, and the JRXML element to create a three-dimensional pie
chart is called
<pie3DChart>
. Just like all JRXML chart elements, these elements
contain a
<chart>
sub-element. They also contain a
<pieDataset>
sub-element,
which in turn contains the
<dataset>
element for the chart, a
<keyExpression>
sub-element, and a
<valueExpression>
sub-element. The
<keyExpression>
sub-
element contains a report expression indicating what to use as a key in the chart.
The
<valueExpression>
sub-element contains an expression used to calculate the
value for the key. The values we see to the left of the equal sign in the chart label
correspond to the
<keyExpression>
(aircraft model, in this case). The values we see
to the right of the equal sign in the chart label correspond to the
<valueExpression>
(number of aircraft of a particular model, in this case).
In this example, the aircraft model is used as the key. It is represented by the report
field called
model
. The value to be used in the chart is the total number of aircrafts of
that model, represented by the
totalAircraft
report variable.
<pieChart>
must contain a
<piePlot>
sub-element containing the chart's
<plot>
element.
<pie3Dchart>
must contain an analogous
<pie3DPlot>
element. Although
<piePlot>
has no attributes,
<pie3DPlot>
has a single optional attribute called
depthFactor
. This attribute indicates the depth (how 'tall' or 'short' the pie chart is)
of the 3-D pie chart. Its default value is
0.2
.