iReport Ultimate Guide - Nimsoft Library

iReport Ultimate Guide - Nimsoft Library iReport Ultimate Guide - Nimsoft Library

13.07.2015 Views

iReport Ultimate GuideFigure 12-9Chart element property sheetCurrently, UR takes advantage of only a small portion of the capabilities of the JFreeChart library. To customizea graph, a class must be written that implements the following interface:net.sf.jasperreports.engine.JRChartCustomizerThe only method available from this interface is the following:public void customize(JFreeChart chart, JRChart jasperChart);It takes a JFreeChart object and a JRChart object as its arguments. The first object is used to actually produce the image,while the second contains all the features you specify during the design phase that are relevant to the customize method.12.5 Using Chart ThemesAnother way to customize graphs is by creating a chart theme, which gives you full control over the style of the chart. Chartthemes allow you to customize the design of a chart. There are several techniques for creating a chart theme, but the simplestone for the end user is to create a JRCTX file (JasperReports Chart Theme XML) using iReport. In this section we will seehow to create such a file and how to use it in a report.To create a JasperReports Chart Theme XML file, select New → Chart Theme from the File menu and specify where to storethe new file (which has the file extension .jrctx).12.5.1 Using the Chart Theme DesignerWhen you create a new chart theme, iReport automatically opens the theme in the Chart Theme Designer. This designer hasthree main views:• Template Inspector. Tree view showing the several sections of the chart that you can customize.• Main view. Displays a real time preview of the theme.• Property sheet. Lists the properties that you can modify.230

ChartsFigure 12-10 Chart Theme DesignerUR organizes a chart theme into seven sub-sections:• Chart• Title• Subtitle• Legend• Plot• Domain Axis• Range AxisiReport allows you to design the properties for each part of the chart theme. Figure 12-11 shows which part of the chart thesesections affect.231

<strong>iReport</strong> <strong>Ultimate</strong> <strong>Guide</strong>Figure 12-9Chart element property sheetCurrently, UR takes advantage of only a small portion of the capabilities of the JFreeChart library. To customizea graph, a class must be written that implements the following interface:net.sf.jasperreports.engine.JRChartCustomizerThe only method available from this interface is the following:public void customize(JFreeChart chart, JRChart jasperChart);It takes a JFreeChart object and a JRChart object as its arguments. The first object is used to actually produce the image,while the second contains all the features you specify during the design phase that are relevant to the customize method.12.5 Using Chart ThemesAnother way to customize graphs is by creating a chart theme, which gives you full control over the style of the chart. Chartthemes allow you to customize the design of a chart. There are several techniques for creating a chart theme, but the simplestone for the end user is to create a JRCTX file (JasperReports Chart Theme XML) using <strong>iReport</strong>. In this section we will seehow to create such a file and how to use it in a report.To create a JasperReports Chart Theme XML file, select New → Chart Theme from the File menu and specify where to storethe new file (which has the file extension .jrctx).12.5.1 Using the Chart Theme DesignerWhen you create a new chart theme, <strong>iReport</strong> automatically opens the theme in the Chart Theme Designer. This designer hasthree main views:• Template Inspector. Tree view showing the several sections of the chart that you can customize.• Main view. Displays a real time preview of the theme.• Property sheet. Lists the properties that you can modify.230

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!