jbuberel Posted July 20, 2009 Share Posted July 20, 2009 I've developed a very simple custom chart theme named 'altostheme' (filename: altostheme.jrctx).Inside my report JRXML, the them is referenced as:<chart renderType="svg" theme="altostheme">The them was developed using iReports-ng v.3.5.2, and then 'exported' into a JAR file (altostheme.jar), which was placed into the iReports-ng root installation directly. When executed from within iReports-nb v3.5.2, everything works correctly.I am now trying to fill the report programatically, and I am getting this stack trace: [java] 2009-07-19 23:22:15 INFO main - Starting generation for spec [50d35da8204a899901204a89a2470001] [java] 2009-07-19 23:22:40 ERROR main - Generic expection thrown during report fill for JASPER file: /home/jason/svn/branches/mywebpage/reports/one_page_themed/one_page_primary_mf.jasper of 50d35da8204a899901204a89a2470001 of customer 52417680 [java] net.sf.jasperreports.engine.JRRuntimeException: Chart theme 'altostheme' not found. [java] at net.sf.jasperreports.charts.util.ChartUtil.getChartTheme(ChartUtil.java:169) [jasperreports-javaflow.jar:na] [java] at net.sf.jasperreports.engine.fill.JRFillChart.evaluateChart(JRFillChart.java:1277) [jasperreports-javaflow.jar:na] [java] at net.sf.jasperreports.engine.fill.JRFillChart.evaluateRenderer(JRFillChart.java:1252) [jasperreports-javaflow.jar:na] [java] at net.sf.jasperreports.engine.fill.JRFillChart.evaluate(JRFillChart.java:1241) [jasperreports-javaflow.jar:na] [java] at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:260) [jasperreports-javaflow.jar:na] [java] at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:486) [jasperreports-javaflow.jar:na] [java] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:1427) [jasperreports-javaflow.jar:na] [java] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:729) [jasperreports-javaflow.jar:na] [java] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:256) [jasperreports-javaflow.jar:na] [java] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:114) [jasperreports-javaflow.jar:na] [java] at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:911) [jasperreports-javaflow.jar:na] [java] at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:814) [jasperreports-javaflow.jar:na] [java] at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:63) [jasperreports-javaflow.jar:na] [java] at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:421) [jasperreports-javaflow.jar:3.5.2] [java] at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:251) [jasperreports-javaflow.jar:3.5.2] [java] at com.altosresearch.report.ReportGenerationMgr.fillReport(ReportGenerationMgr.java:411) [classes/:na]I have attempted to add to the JRPropertyMap:JRProperties.setProperty("net.sf.jasperreports.xml.chart.theme.altostheme", "/full/path/to/altostheme.jrctx");But although the JRXML file compiles correctly, it fails to find the theme during fill-time.So my questions is:What steps should I be taking to inform the report filler of the proper location of either the 'altostheme.jrctx' or the packaged 'altostheme.jar' file at runtime?Thanks,Jason Link to comment Share on other sites More sharing options...
jbuberel Posted July 20, 2009 Author Share Posted July 20, 2009 The approach shown above is based on my reading through the source code found in XmlChartThemeExtensionsRegistryFactory. Is there some better example of how to 'register' a new chart theme at runtime? Link to comment Share on other sites More sharing options...
jbuberel Posted July 20, 2009 Author Share Posted July 20, 2009 I'm now starting to understand this. Chart theme support is NOT part of the jasperreports.jar feature set as of v3.5.2. In the iReports distribution, I see that the charttheme sample code is actually encapsulated into the extension module 'jasperreports-chart-themes-3.5.2.jar' jarfile. So the approach I will now pursue is the integration of the charttheme sample/demo app into my standard jasperreports-3.5.2 infrastructure. I then only need to figure out the 'proper' way to then register my theme (at run time) properly. I'll writeup another HOWTO when I get it working, but any suggestions or hints are welcome. Link to comment Share on other sites More sharing options...
jbuberel Posted July 20, 2009 Author Share Posted July 20, 2009 Answered, with a complete tutorial: http://blog.altosresearch.com/howto-integrate-jasperreports-chart-themes/ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now