Wednesday, January 23, 2013

Creating BIP Gantt Charts using JFreeChart

An overlooked feature of BI-Publisher is the ability to create custom extensions in Java in order to add capabilities beyond the out of the box features.  Tim Dexter blogged about this undocumented feature several years ago.
Using this feature, I was able to integrate BI Publisher with JFreeChart an Open Source plotting API in order to generate plots that are not provided by BI-Publisher such as the Gantt chart type. The main steps are as follows:
1) Create the BIP data model: as an example I used the sample Gantt data set from the amis website.
image

2) Create the BIP extension code in Java, I used Tim Dexter’s example as a starting point. I plan on sharing the custom code once I get a chance to clean it up.
Creating Gantt chart using JFreeChart is very straightforward and there are several examples on the web, other more sophisticated types of plots (box plots etc…) require more work. The only difficulty with JFreeChart is that it doesn’t support XML dataset as input, there are ways around that limitation
You’ll need the following JAR files available on the web:
· jfreechart-1.0.4.jar
· jcommon-1.0.8.jar
· Commons-code-1.5.jar
The resulting JAR file will have to be copied to the location expected by Weblogic, on my PC it is:
C:\fusion\user_projects\domains\bifoundation_domain\lib
 
image

3) Create the BIP template, I used Template builder to create an RTF template with 3 fields
 
image

Namespace:
Create Gantt Chart: is the call to the custom Java code. My custom code call is:

I am basically feeding the XML data from BI-Publisher to the JFREECHART API as well as the XML tags
Display Gantt Chart: renders the resulting image (Gantt Chart) from JFreeChart
;

5) Change the “Disable External References” flag to “FALSE” (it is TRUE by default) in BI-Publisher
 
image

6)  Upload your RTF template, bounce the services and voila!
 
image
Pretty basic but the look and feel of this can be greatly improved by tweaking the JFreeChart API.
a+
Fiston