Creating and Uploading Chart Themes
Using Jaspersoft Studio, you can create new chart themes to give a custom look to any JFreeChart. You can set the fonts, colors, line widths, and other settings that determine the appearance of charts. Then upload the chart theme for use in reports generated on the server, either on a report-by-report basis or as a global setting for all charts that don't provide their own theme.
To create a new chart theme in Jaspersoft Studio:
| 1. | Select File > New > Other. The New wizard appears. |
| 2. | Expand Jaspersoft Studio, select Chart Themes, and click Next. The new file dialog suggests a default file name. Chart themes use the .jrctx file extension. |
New Chart Theme in Jaspersoft Studio |
![jss-new-chart-theme-dialog.png.63e8ba94903859f449511ee9db08d630.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) |
| 3. | Specify a location, enter a name, and click Finish. |
The chart theme editor appears; it displays several types of charts to help you understand how the theme will be applied to each.
The available options are based on the JFreeChart library used to generate charts.
![note-icon-ns.png.9e923964179268f043813da98d2b8a94.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) | Jaspersoft Studio supports only the most common options provided by JFreeCharts. |
| 4. | In the Outline view, select each category and review the available options in the Properties view. |
| 5. | Select a property to change its value. |
Depending on the nature of the property, you might type text, select a color, check or clear a check box, or select a value from a drop-down. As you update the chart theme, the Preview tab shows your changes. For example, select Title in the Outline view and choose Bottom from the Position drop-down to move the title beneath the chart.
| 6. | Click a chart type in the Preview tab to zoom in to examine the effects of your changes more closely. Click again to zoom out. |
![jss-chart-theme-preview.png.ad3ee85431e25f373d650598b1394cfb.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) |
A Chart Theme Edited in Jaspersoft Studio |
| 7. | To view the XML that defines the chart theme’s appearance, click the Source tab. |
| 8. | When you are satisfied with the chart theme, click File > Save to save the chart theme. This saves the chart theme to your local hard drive. |
To export your theme as a JAR File:
| 1. | Select your chart theme and click the Export Chart Theme jar icon on the toolbar. A Save As dialog opens. |
Exporting a Chart Theme |
![jss-chart-themes-export.png.e2d0c3718240fb2c654367ccf4c3bcf3.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) |
| 2. | Choose the location where you want to save your JAR. To upload to an instance of JasperReports Server, select your server instance and then select the Templates directory. To create a jar on your current system, select a location on your hard drive. |
| 3. | Enter a file name and theme name for your theme. |
| 4. | If you want to use the theme to design reports on your current system, save to a location on your hard drive and select Add the jar to the CLASSPATH to use the theme in the report designer. |
| 5. | Click OK. The chart theme is exported as a JAR. |
![note-icon-ns.png.c6d76215b7ce1118b5e91e56f6f2bb82.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) | Once you have uploaded a theme to JasperReports Server, you can use the repo: syntax in your reports to specify this JAR as your chart theme. The theme can be used at the report or server level in JasperReports Server. For more information, refer to the JasperReports Server Administrator Guide. |
Recommended Comments
There are no comments to display.