Java Reference
In-Depth Information
Adding Charts and Graphics
to Reports
All the reports we have seen so far contain only textual data. JasperReports has the
capability to create reports with graphical data in them, including simple geometric
shapes, images, and charts. Adding graphical representation of the data makes it
easier to visualize. Moreover, adding images and other graphical elements allows
us to create more appealing reports. In this chapter, we will cover how to take
advantage of JasperReports' graphical features.
The following topics will be covered in this chapter:
Adding simple geometrical shapes to a report
Adding images to a report
Adding different types of 2-D and 3-D charts to a report
Adding Geometrical Shapes to a Report
JasperReports supports adding lines, rectangles, and ellipses to a report. This
capability allows us to display simple graphics in a report. The following sections
will discuss each one of these elements in detail.
Adding Lines to a Report
Lines can be added to a report by using the JRXML <line> element. Lines are
drawn as a diagonal from one corner of the area, defined by the <reportElement>
sub-element, to the other. The JRXML <line> element has a single attribute called
direction . This attribute has two valid values, namely, BottomUp , which indicates
that the line will go from the bottom corner to the top corner, and TopDown , which
Search WWH ::

Custom Search