Java Reference
In-Depth Information
Adding Charts to a Report
JasperReports supports several kinds of charts including pie charts, bar charts, XY
bar charts, stacked bar charts, line charts, XY line charts, area charts, XY area charts,
scatter-plot charts, bubble charts, time-series charts, high-low charts, and candlestick
charts. We will discuss each one of these in detail, but before we do so, let us discuss
some common properties across all charts.
There is a JRXML element used to create each type of chart. All of these elements
will be discussed in subsequent sections. Each of these elements must contain a
<chart> element as one of its sub-elements. The <chart> element must contain
a <reportElement> to define the chart's dimensions and position as one of its
sub-elements. It may also contain a <box> element to draw a border around the
chart, a <chartTitle> sub-element to define and format the chart's title, and a
<chartSubtitle> sub-element to define and format the chart's subtitle.
Attributes of the <chart> Element
The JRXML <chart> element contains a number of attributes that allow us to control
the way a chart looks and behaves. The most commonly used attributes are listed in
the following sections.
This is the name of a class �optional) that can be used to customize the chart. The
value for this element must be a String containing the name of a customizer class.
When evaluationTime is Group , this attribute determines the name of the group to
be used to evaluate the chart's expressions. The value for this attribute must match
the name of the group we would like to use as the chart's evaluation group.
This attribute determines when the chart's expression will be evaluated. The valid
values for this attribute are listed below:
Band : The chart expression is evaluated when the containing band has
finished rendering all other elements.
Column : The chart expression is evaluated when rendering all other elements
in the current column is finished.
Search WWH ::

Custom Search