2005 IR Help Posted September 2, 2006 Share Posted September 2, 2006 By: Bonkers - darthbonkers customizerClass with charts seems not working 2005-10-28 03:28 Hi, i try to use a customizerClass for my chart but it doesnt change my chart! what im doing wrong? please maybe somebody can test it or just say it is working for you, so i know it isnt a bug. i use this custom code: import java.awt.Color; import net.sf.jasperreports.engine.JRChart; import net.sf.jasperreports.engine.JRChartCustomizer; import org.jfree.chart.JFreeChart; import org.jfree.chart.axis.CategoryAxis; import org.jfree.chart.axis.CategoryLabelPositions; import org.jfree.chart.plot.CategoryPlot; import org.jfree.chart.renderer.category.BarRenderer3D; public class BarChartCustomizer implements JRChartCustomizer { public void customize(JFreeChart chart, JRChart jasperChart) { BarRenderer3D renderer = (BarRenderer3D) chart.getCategoryPlot().getRenderer(); renderer.setSeriesPaint(0, Color.red); CategoryPlot plot = chart.getCategoryPlot(); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); } } The BarChartCustomizer.class and BarChartCustomizer .java is in the same directory like my report.jrxml. My Report tag: customizerClass="BarChartCustomizer" Thanks a lot DarthBonkers Link to comment Share on other sites More sharing options...
jkoorts Posted September 20, 2006 Share Posted September 20, 2006 Hi, I see many people (including me have the same problem). Its very discouraging that there is no tutorial on how to do this. I went and bought the jasper reports book to see if that helps, but they skipped the customizer bit. somehow i wonder if this feature even works. I mean little help from Admin on any customizer posts. the books steers away from it, and there is no tut on the web. going over to jfreechart's website you also see no posts for it. I did get the nullpointer problems solved though. You need to jar your class, and then put it in your ireport's classpath (assuming you're testing it with ireport, which i do). I'm now getting the following error: Error filling print... Null 'key' argument.java.lang.IllegalArgumentException: Null 'key' argument. at org.jfree.data.DefaultKeyedValues.setValue(DefaultKeyedValues.java:225) So it looks like its at least looking at my class. I'll report back when i got this solved. Here a copy of my customizer class. import net.sf.jasperreports.engine.*;import org.jfree.chart.JFreeChart; public class customizemychart implements JRChartCustomizer{ public void customize(JFreeChart jfreechart,JRChart jasperChart) { jfreechart.setTitle("Setting the title of the chart im customizing!"); }} Link to comment Share on other sites More sharing options...
jkoorts Posted September 27, 2006 Share Posted September 27, 2006 hi ok, i got it working. the trick is not to use ireport to test this. well that was the trick for me, i found ireport too riddled with bugs. the trick is to test it from a java app. see jasperreports doc on how to 1. compile a jrxml file2. fill a report Remember to add your customizer class to your java apps classpath. Attached is the customizer jar, the jrxml and the java app. its not neat i know, its just a scratch app i used to get the stuff working. [file name=JasperReport.zip size=3871]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/JasperReport.zip[/file] Link to comment Share on other sites More sharing options...
atanupanda Posted February 6, 2007 Share Posted February 6, 2007 HiThis is Atanu. I am very new in ireport and also in java environment. In the ireport I have designed a template .like this.please look on attach file size=150]C:Documents and SettingsAtanuMy Documentsgraph.jpegNow I want to plot a line graph on the basis of the each data like t1 t2 ---t5 and lcl, ucl, actual value for each row.That I have done. Now my problem is that I have to change the color of points of t1 t2 ---t5 on the basis of Lcl and Ucl . If the value of t1 ,or t2 or ----t5 are between Ucl and Lcl the color will be blue. And if it out side of Lcl and Ucl then it will be red..I want the following figure. Where the upper bold line is Ucl and lower bold line isLcl size=150]C:Documents and SettingsAtanuMy Documentsdata.jpeg Actually I have got a information that for that I have to write a customizer class for chart. Also I have write it . Code:Now this customize class ok running successfully with creating jar files.Now I want to create a logic to check the value of t1 t2 t3 t5 with respect to UCL and LCL. How can I fetch data from report.Or is there any other way to do this.Is there any way to pass value from iReport to customizer class ? What should I do. Please please help me. It’s urget for me. Any help would be greatly appreciated. Thanks in advance. [file name=query-37ab101e3a539a71be9c962f72749d92.doc size=49152]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/query-37ab101e3a539a71be9c962f72749d92.doc[/file] Post edited by: atanupanda, at: 2007/02/06 10:06 [file name=query-fa9f4dfa6779100ef3de23918dc3f85b.doc size=49152]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/query-fa9f4dfa6779100ef3de23918dc3f85b.doc[/file] size=159]http://www.jasperforge.org/components/com_joomlaboard/uploaded/images/graph-bee6bf96149cd5832e17a5c51593322f.JPG 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