Customizer Classes are the Java Classes which can be used to implement or change the appearance and properties of Charts. Jaspersoft Studio uses Jfree chart APIs to build charts and by using Customizer code, we can extend the functionality and appearance of these charts to our needs. In this section I am going to explain how we can use a simple Customizer class in a sample report. To learn how to build a simple Report in Jaspersoft Studio, check our section “Creating your first Report“.

In this Sample Report I am going to use the “Sample DB” available with Jaspersoft Studio download.

1) Launch Jaspersof Studio.

2) Click File –> New –> Jasper Report

3) Select the Data Adapter as “Sample DB”

4) Write the below code in to the query editor.

select count(orderid) as totalorder,
shipcity,
shipcountry
from orders
where shipcountry in ('Brazil', 'USA','France','Italy')
and shipcity in ('Reims','Rio de Janeiro','Lyon','Reggio Emilia','Sao Paulo','Lille','Torino','Portland','San Francisco', 'Paris','Butte','Versailles')
group by shipcountry,shipcity

5) To create a chart, drag the Chart item from the Palette and drop it either onto the title band or the summary band. Select  ( only the Items in Title or the Summary Band appears once in the report and Hence use these bands to display Chart or Cross Tab data).

6) select the Value, Series and Category fields as below

Chart Data Configuration (www.rajeshsirsikar.com)

7) Fit the Chart to the band by Right Clicking on the Chart and selecting ” Stretch to Content”.

8) I have also used Series field as the “SHIPCITY” Name and have all the 3 fields in the Details section. So the report looks like this.

Report 1 (www.rajeshsirsikar.com)

9) Lets create a Customizer Class to modify the Legend Items to display them in a list.

10 ) To do this you need to Install Eclipse plugin. Please download and install the same from below link

Eclipse Download

11) Watch the below video I created for the complete step of creating a customizer class code to “Display Legend Values in Vertical List at the side of the chart”

And the general Code to start any Customizer project in eclipse is below.

Customizer Code