In a project I am working on, we need to visualise some information as Reports. I am going to test the main popular tools, so I wanted to share my little “research”.
First tool: BIRT
The Business Intelligence and Reporting Tool (BIRT) project provides the BIRT technology platform to create data visualizations and reports that can be embedded into rich client and web applications.
BIRT is open source and a top-level software project within the Eclipse Foundation.
Java 1.6 JDK/JRE (see How to install Java)
MySQL Server (see How to install MySQL)
JDBC Connector (Download it from: http://dev.mysql.com/downloads/connector/j/)
There are several ways to get started with BIRT. The fastest way is to download the All-in-one package. This download includes everything you need to start creating BIRT designs, including the full Eclipse SDK.
If we have Eclipse already installed, we can get all the BIRT plug-ins for our existing Eclipse environment. This is our choice.
1) Open Eclipse and go to Help–> Install new software…
In the Update Manager, give the path to the repository: http://download.eclipse.org/birt/update-site/4.3
You can choose your right version in: http://wiki.eclipse.org/BIRT_Update_Site_URL
Select the plugin you want to install, and follow the steps.
2) Create a Workspace
Once Birt is installed, in order to separate our reporting projects from the eclipse ones – and as a good practice-, we are going to create another workspace.
Go to File –> Switch Workspace –> Other…
Choose your folder, or write a new one (it will be created) and click on OK.
3) Change Perspective
Go to Windows –> Open Perspective –> Others… and select Report Design.
4) Create a Project
Now we can start creating a project.
Go to File –> New –> Project
Select Report Project (You can use the filter to look for it)
Click Next, write the name of the project (in this example: FirstReport) and then Finish.
5) Create a report
Now, we can create a report: File –> New –> Report
Here, it’s possible to choose the project or parent folder we want to use. Also, we can give a name to the file, e.g mysqlreport.rptdesign.
After click on Finish, we should see something like this:
6) Create a Data Source
Now it’s time to create a Data Source for our report. In the bottom left corner we can select the Outline Tab, right-click on Data Sources and click on New Data Source.
7) Setting up the Data Source
Because we are going to use a MySQL database as a Data Source, we select Create from a data source type in the following list. In the list, we click on JDBC Data Source. We can leave the name by default or pick a new one.
7.1) Add JDBC Connector
After click on Next, we will see the following screen:
Before, we can give a Driver Class, we must add the MySQL JDBC Connector. In order to do that, we should click on Manage Drivers…
By clicking in Add…, we can select the JDBC downloaded and extracted from dev.mysql.com (see Prerequisites). Once we have selected the jar file (in this example: mysql-connector-java-5.1.34-bin.jar), we can click on OK.
Now, we can full the form.
Driver Class: com.mysql.jdbc.Driver (v5.1)
*where 220.127.116.11 is your Server IP. If you are working in a local instance, you may try: 127.0.0.01
User Name: “database user”, e.g. root
Before clicking on Finish, we can test the connection. If we get the a “Connection successful”, we got it.
8) Create a Data Set
We have created a Data Source, now it’s time to create a Data Set from that source. In the Outline Tab, right-click on Data Set, and then click on New Data Set.
We select the Data Source we have created before, in Data Set Type, we choose SQL Select Query and finally we give a name to the Data Set.
In the Query windows we can introduce, visually or by typing, an sql statement.
At this point, a dummy example is taken: Select * from actor. Don’t worry, we can change it later. Click on Finish and the following screen will appear:
This is the screen where we can modify our Data Set. We can click on Query and modify the sql statement.
In this case, we have: Select actor.last_name,count(*) from actor where actor.last_name=’KILMER’. In other words, we want to know how many people have the last name Kilmer. It’s still a dummy example, but for our purposes is enough for now.
9) Add a chart.
Now that we have a Data Set, we can add a chart. Just go to the Palette Tab and double click on Chart. Also, you can drag and drop it where you want.
The chart builder will appear:
10) Setting up the chart.
10.1 Select Chart Type
In the Select Chart Type, we we select Bar. Now, we can click on Next button or directly on Select Data tab.
10.2 Select Data
In Data Preview, click on the last_name column heading, and drag it to the empty Category (X) Series field. The following expression appears: row[“last_name”]
Repeat the action by selecting the nKilmers column header, and drag it to the empty field in Value (Y) Series.
10.3 Format Chart
Finally we can modify different aspect of the chart format, for instance, the Title: My First Report. After all changes have been made, click on Finish.
11) Visualizing the report.
By default, we come back to the Layout tab (page). Here, the report is not rendered and we will see a picture like this:
If we want to see our fantastic report rendered, we can choose Preview and will preview the report in the report editor.
It was a first approach to BIRT. The following step is how to embed a chart in a web application.