views:

2081

answers:

1

I am attempting to create a Chart Theme for my Jasper Reports, to enable all charts to be branded for the company.

So far I have managed to find that the default chart theme appears to be set in

jasperreports.properties
using the following property:
net.sf.jasperreports.chart.theme=default.spring

I have also found the example chart themes application in the jasper reports download, however there appears to be no documentation with this.

I can also see that it requires the use of the

jasperreports_extension.properties
file to specify the following property:
net.sf.jasperreports.extension.registry.factory.chart.theme
however there appears to be no documentation or tutorials on actually using this property.

Does anyone have any experience using chart themes or know of any documentation, blog posts etc that my be of use?

A: 

I have had the exact same question today.

The theme is defined in the XML like so:

<timeSeriesChart>
    <chart hyperlinkType="None" theme="eye.candy.sixties">
    ....
</timeSeriesChart>

To actually provide this theme, a .jar included in the classpath needs to provide a ChartThemeBundle singleton instance that returns a subclass of ChartTheme.

The ChartTheme subclass then has to implement a whole bunch of methods.

Probably the best approach to take is to download the source code of JasperReports (http://sourceforge.net/projects/jasperreports/files/) and look in the directory:

demo/samples/charts/src/net/sf/jasperreports/charts/themes/

Then, select a theme to extend from, subclass it and implement the methods you care about.

Jamie Love