<!-- End 3D Bar Chart -->
As we can see from the given example, the process used to create bar charts is very
similar to creating pie charts. This example creates two bar charts, a two-dimensional
one and a three-dimensional one. Let us discuss the two-dimensional one first.
The JRXML element used to create a two-dimensional bar chart is <barchart> . Just
like all charts in JasperReports, it must contain a <chart> sub-element, which contains
a <reportElement> sub-element defining the chart's dimensions and position.
The <dataset> element in a bar chart must be enclosed between
<categoryDataSet> and </categoryDataset> JRXML elements.
<categoryDataSet> must contain a <categorySeries> element. This element
defines what data element the bars will represent �aircraft models, in this example).
<categoryDataSet> must also contain a <categoryExpression> element, which
defines how the data will be separated into categories for comparison. In the
previous example, data is separated by city. The <valueExpression> element
defines what expression to use to determine the value of each bar in the chart.
If we want to create 3-D bar charts, the JRXML element to use is <bar3Dchart> ,
which works almost exactly the same way as <barChart> . The only difference is that
the <plot/> element must be a sub-element of <bar3DPlot> . <bar3DPlot> contains
three attributes, isShowLabels , which determines if labels will be shown in the
chart, xOffset , and yOffset , whose valid values are numeric values indicating the
number of pixels to use for the 3-D effect on the x and y axis, respectively.
XY Line Charts
XY line charts allow us to view the relationship between two numerical values. For
our next example, let us suppose we need to generate a report for a flight school
to illustrate how much the operating cost will be for flying a particular model of
their aircraft. Let us assume the flight school has an inventory of 43 of these aircraft,
and that the operating cost per day of each aircraft is $45. The JRXML template to
generate a report with a chart illustrating the operating cost would look like this: