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.
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
indicates that the line will go from the top corner to the bottom corner. The default value for the direction
attribute is TopDown
.
The following example demonstrates the use of the<line>
element:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE jasperReport PUBLIC "...