Pentaho Reporting 3.5 for Java Developers
Pentaho Reporting lets you create, generate, and distribute rich and sophisticated report
content from different data sources. Knowing how to use it quickly and efficiently gives
you the edge in producing reports from your database. If you have been looking for a
book that has plenty of easy-to-understand instructions and also contains lots of examples
and screenshots, this is where your search ends.
This book shows you how to replace or build your enterprise reporting solution from
scratch with Pentaho’s Reporting Suite. Through detailed examples, it dives deeply into
all aspects of Pentaho’s reporting functionalities, providing you with the knowledge you
need to master report creation.
What This Book Covers
Chapter 1—An Introduction to Pentaho Reporting provides a quick overview of Pentaho
Reporting, including a feature summary and architectural summary, as well as a history
of the product.
Chapter 2—Pentaho Reporting Client and Enterprise Examples tells how to install and
create reports, and how to embed reports in your J2EE and client Java applications.
Chapter 3— Pentaho Reporting Examples in the Real World tells how to connect to a
JDBC data source and create realistic inventory, balance, and invoice reports, including
charts and sub-reports.
Chapter 4—Design and Layout in Pentaho’s Report Designer takes a deep dive into
Pentaho’s Report Designer, learning how to create great-looking reports.
Chapter 5—Working with Data Sources teaches the various ways to connect your
report to live data, including JDBC, Hibernate, Java Beans, OLAP, and many other
data sources.
Chapter 6—Including Charts and Graphics in Reports is about incorporating Pie, Bar,
Line, and many other chart types in your reports, as well as including dynamic images in
your report.
Chapter 7—Parameterization, Functions, Formulas, and Internationalization in Reports
defines parameters for dynamic report generation. It helps you write formulas and use
available functions for rich summary and calculated values in your reports, along with
dynamically adjusting colors and styles using expressions in your report.
Chapter 8—Adding Sub-Reports and Cross Tabs to Reports gives an overview of how to
build reports that include side-by-side sub-reports and cross tabs.
Chapter 9—Building Interactive Reports teaches how to add dynamic interaction to
HTML and Swing reports, for immediate feedback and dashboard-like functionality.
Chapter 10—API-based Report Generation is about building reports from XML and by
using Pentaho Reporting’s Java Bean API.
Chapter 11—Extending Pentaho Reporting teaches how to write custom functions and
elements within Pentaho Reporting.
Chapter 12—Additional Pentaho Reporting Topics discovers how to use Pentaho
Reporting with the Pentaho BI Server, including Pentaho Metadata. It aids in learning
more about Pentaho Reporting’s open source approach, and how you can contribute to the
free software movement.
Including Charts and Graphics in Reports
In this chapter, you’ll learn how to incorporate charts and graphics into Pentaho
Reports. You’ll learn about the different types of charts supported, and how to
configure them in Pentaho Report Designer. You’ll also learn how to populate a
chart with various types of data.
In addition to learning all about charts, this chapter also covers the various methods
for including visual information in your report, including embedding images and
Java graphics in your report.
Supported charts
Pentaho Reporting relies on JFreeChart, an open source Java chart library, for
charting visualization within reports. From within Report Designer, many chart
types are supported. In the chart editor, two areas of properties appear when
editing a chart. The first area of properties is related to chart rendering, and the
second tabbed area of properties is related to the data that populates a chart.
Following is the screenshot of the chart editor within Pentaho Report Designer:

All chart types receive their data from three general types of datasets. The first type
is known as a Category Dataset , where the dataset series and values are grouped
by categories. A series is like a sub-group. If the exact category and series appear,
the chart will sum the values into a single result. The following table is a simple
example of a category dataset:
| Category | Series | Sale Price |
|---|---|---|
| Store 1 Sales | Cash | $14 |
| Store 1 Sales | Credit | $12 |
| Store 2 Sales | Cash | $100 |
| Store 2 Sales | Credit | $120 |
Pentaho Reporting builds a Category Dataset using the CategorySetDataCollector.
Also available is the PivotCategorySetCollector, which pivots the category and
series data. Collector classes implement Pentaho Reporting’s Function API.
The second type of dataset is known as an XY Series Dataset, which is a two
dimensional group of values that may be plotted in various forms. In this dataset,
the series may be used to draw different lines, and so on. Here is a simple example
of an XY series dataset:
| Series | Cost of Goods (X) | Sale Price (Y) |
|---|---|---|
| Cash | 10 | 14 |
| Credit | 11 | 12 |
| Cash | 92 | 100 |
| Credit | 105 | 120 |
Note that X is often referred to as the domain, and Y is referred to as the range.
Pentaho Reporting builds an XY Series Dataset using the XYSeriesCollector.
The XYZSeriesCollector also exists for three dimensional data.
The third type of dataset is known as a Time Series Dataset , which is a two
dimensional group of values that are plotted based on a time and date. The Time Series
Dataset is more like an XY Series than a Category Dataset, as the time scale is displayed
in a linear fashion with appropriate distances between the different time references.

Pentaho Reporting builds a Time Series Dataset using the TimeSeriesCollector.
Common chart rendering properties
Most charts share a common set of properties. The following properties are common
across most charts. Any exceptions are mentioned as part of the specific chart type.




Common category series rendering properties
The following properties appear in charts that render category information:




Common XY series rendering properties
The following properties appear in charts that render XY series information.








November 21, 2009
Java