Introduction
Charting data that have widely differing values can be difficult using a single data axis. By using two or more axes, the data can be more easily understood. iReport Designer includes built-in support for multi-axis charts through the use of the JFreeChart package.
Product Versions
iReport Designer Professional 3.5.0 was used to create this tutorial.nIt should work identically in later versions of iReport Designer Professional and iReport Designer Community Edition. The concepts apply to older versions of iReport Designer, but the user interface differs.
Objectives
This guide will enable you to:
- Create a new report
- Create a simple line chart
- Create a more useful multi-axis chart
- Combine a bar chart with a line chart
Pre-Requisites
Familiarity with iReport Designer is helpful.
Creating a New Report
To create a new report, set these report properties:
A new empty report with sample SQL query to get started is available here. Note: The SQL query in the sample report returns some hard-coded sample data; it does not refer to any tables in the database. This way it can be used with any valid SQL datasource. It has been tested with MySQL and PostgreSQL, but it should also work with most other database technologies. |
Creating a Simple Line Chart
Follow these steps to create a simple line chart.
Creating a Multi-Axis Chart
Follow these steps to create a multi-axis chart.
Combining a Bar Chart with a Line Chart
The use of two different axes makes it easier to see the trends. However, the lines have a tendency to overlap since both charts will rise to the same height. Combining a bar chart with a line chart is a good solution to this issue.
Step | Action |
1 | Edit the chart data in the first line chart. Copy the Sales series |
2 | Delete the first line chart |
3 | Right-click the Multi Axis chart and add a new Bar chart |
4 | Edit the bar chart data and paste the series |
5 | The combined use of bar and line charts makes the data easier to understand quickly |
What's Next?
These sample charts may be improved in many ways:
- The axes should be labeled more clearly
- A chart title makes it easier for a viewer to understand it quickly
The report can now be deployed to JasperReports Server for use in a dashboard or to be scheduled for regular delivery.
Recommended Comments
There are no comments to display.