Java Reference
In-Depth Information
Other Types of Charts
As we have seen in previous examples, all JRXML elements used to display a
chart follow a pattern. First, we have the element that determines what chart
to plot ( <pieChart> , <barChart> , etc.). Inside that element we have a <chart>
element, followed by an element enclosing the <dataset> element ( <pieDataset> ,
<categoryDataset> , etc.), followed by another element enclosing the <plot>
element ( <piePlot> , <barPlot> , etc.). Since all charts follow the same pattern,
it would be redundant to show examples for all chart types supported by
JasperReports. In the following table, we will discuss the elements used to create all
other supported chart types, without explicitly showing examples. The JasperReports
project files include examples for all chart types. They can be found in the demo/
samples/charts directory.
Chart Type Chart Element Dataset Element Plot Element
XY Bar Chart <xyBarChart> <xyDataset> <barPlot>
Stacked Bar Chart <stackedBarChart> <categoryDataset> <barPlot>
Line Chart <lineChart> <categoryDataset> <linePlot>
Area Chart <areaChart> <categoryDataset> <areaPlot>
XY Area Chart <xyAreaChart> <xyDataset> <areaPlot>
Scatter Plot Chart <scatterChart> <xyDataset> <scatterPlot>
Bubble Chart <bubbleChart> <xyzDataset> <bubblePlot>
Time Series Chart <timeSeriesChart> <timeSeriesDataset> <timeSeriesPlot>
High Low Chart
Candlestick Chart <candlestickChart> <highLowDataset>
You can find details of the attributes for each of these at .
In this chapter, we learned to further customize our reports by adding graphical
elements. We added geometric figures like rectangles, ellipses, and lines to our
reports by using the <line> , <rectangle> , and <ellipse> JRXML elements.
Images, such as company logos, can be added to our reports by making use of the
<image> JRXML element. JasperReports supports several types of charts and these
can be easily added to our reports by using the appropriate JRXML element such as
<pieChart> , <barChart> , <xyLineChart> , etc.
Search WWH ::

Custom Search