2005 IR Help Posted September 3, 2006 Share Posted September 3, 2006 By: Gunny99 - gunny99 Setting a chart's range?? 2005-10-07 07:00 My report has several charts based upon a dataset of server performance monitors and each chart (e.g.: CPU utilization) has it's own range. I need to be able to set these to a fixed 0-100. Is it possible to manually set the range on a chart? By: bill - rx7haze RE: Setting a chart's range?? 2006-05-25 09:52 I too am trying to adjust the range on the value axis. If you do a search on this topic you'll notice there is never an answer for this question. Someone out there must know how to set this as I've seen plenty of samples that appear to have been modified. I'm assuming it can't be done in the GUI but there must be a way to modify the jrxml file. I don't know much about java programming but if you look at the JFreeChart API it looks possible. By: bill - rx7haze RE: Setting a chart's range?? 2006-05-26 14:17 I've lost track of how many hours I've spent trying to figure this out. It looks like setting the range is possible by using the Customizer class in the chart properties. I've seen it stated that this can open up the entire JFreeChart API to iReport. I found a sample of a customizer class located in the jasper reports download in the location jasperreports-1.2.2demosampleschartsbarchartcustomizer.java. This all makes sense to me but now I can't figure out how to reference the customizer class. I tried setting the classpath to reference the directory...that didn't work. I tried putting it in the lib directory of iReport...that didn't work. Finally I tried putting it in the same directory as the report...that didn't work. This is the only thing holding me back from using iReport as my total reporting solution. Thanks. By: bill - rx7haze RE: Setting a chart's range?? 2006-05-26 15:16 Forgot to post in previous message. Here's the error I get. Error filling print... java.lang.ClassNotFoundException: BarChartCustomizer at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at net.sf.jasperreports.engine.util.JRClassLoader.loadClassForName(JRClassLoader.java:90) at net.sf.jasperreports.engine.fill.JRFillChart.<init>(JRFillChart.java:260) at net.sf.jasperreports.engine.fill.JRFillObjectFactory.getChart(JRFillObjectFactory.java:551) at net.sf.jasperreports.engine.base.JRBaseChart.getCopy(JRBaseChart.java:470) at net.sf.jasperreports.engine.fill.JRFillElementGroup.<init>(JRFillElementGroup.java:88) at net.sf.jasperreports.engine.fill.JRFillElementContainer.<init>(JRFillElementContainer.java:88) at net.sf.jasperreports.engine.fill.JRFillBand.<init>(JRFillBand.java:77) at net.sf.jasperreports.engine.fill.JRFillObjectFactory.getBand(JRFillObjectFactory.java:374) at net.sf.jasperreports.engine.fill.JRFillGroup.<init>(JRFillGroup.java:76) at net.sf.jasperreports.engine.fill.JRFillObjectFactory.getGroup(JRFillObjectFactory.java:353) at net.sf.jasperreports.engine.fill.JRFillVariable.<init>(JRFillVariable.java:83) at net.sf.jasperreports.engine.fill.JRFillObjectFactory.getVariable(JRFillObjectFactory.java:333) at net.sf.jasperreports.engine.fill.JRFillDataset.addVariable(JRFillDataset.java:275) at net.sf.jasperreports.engine.fill.JRFillDataset.setVariables(JRFillDataset.java:265) at net.sf.jasperreports.engine.fill.JRFillDataset.<init>(JRFillDataset.java:219) at net.sf.jasperreports.engine.fill.JRFillObjectFactory.getDataset(JRFillObjectFactory.java:1032) at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:374) at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:92) at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:74) at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:147) at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:83) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:601) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:517) at it.businesslogic.ireport.IReportCompiler.run(IReportCompiler.java:653) at java.lang.Thread.run(Unknown Source) NESTED BY : java.lang.ClassNotFoundException: BarChartCustomizer at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at net.sf.jasperreports.engine.util.JRClassLoader.loadClassForName(JRClassLoader.java:90) at net.sf.jasperreports.engine.fill.JRFillChart.<init>(JRFillChart.java:260) at net.sf.jasperreports.engine.fill.JRFillObjectFactory.getChart(JRFillObjectFactory.java:551) at net.sf.jasperreports.engine.base.JRBaseChart.getCopy(JRBaseChart.java:470) at net.sf.jasperreports.engine.fill.JRFillElementGroup.<init>(JRFillElementGroup.java:88) at net.sf.jasperreports.engine.fill.JRFillElementContainer.<init>(JRFillElementContainer.java:88) at net.sf.jasperreports.engine.fill.JRFillBand.<init>(JRFillBand.java:77) at net.sf.jasperreports.engine.fill.JRFillObjectFactory.getBand(JRFillObjectFactory.java:374) at net.sf.jasperreports.engine.fill.JRFillGroup.<init>(JRFillGroup.java:76) at net.sf.jasperreports.engine.fill.JRFillObjectFactory.getGroup(JRFillObjectFactory.java:353) at net.sf.jasperreports.engine.fill.JRFillVariable.<init>(JRFillVariable.java:83) at net.sf.jasperreports.engine.fill.JRFillObjectFactory.getVariable(JRFillObjectFactory.java:333) at net.sf.jasperreports.engine.fill.JRFillDataset.addVariable(JRFillDataset.java:275) at net.sf.jasperreports.engine.fill.JRFillDataset.setVariables(JRFillDataset.java:265) at net.sf.jasperreports.engine.fill.JRFillDataset.<init>(JRFillDataset.java:219) at net.sf.jasperreports.engine.fill.JRFillObjectFactory.getDataset(JRFillObjectFactory.java:1032) at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:374) at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:92) at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:74) at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:147) at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:83) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:601) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:517) at it.businesslogic.ireport.IReportCompiler.run(IReportCompiler.java:653) at java.lang.Thread.run(Unknown Source) NESTED BY : net.sf.jasperreports.engine.JRRuntimeException: Could not create chart customizer instance. at net.sf.jasperreports.engine.fill.JRFillChart.<init>(JRFillChart.java:263) at net.sf.jasperreports.engine.fill.JRFillObjectFactory.getChart(JRFillObjectFactory.java:551) at net.sf.jasperreports.engine.base.JRBaseChart.getCopy(JRBaseChart.java:470) at net.sf.jasperreports.engine.fill.JRFillElementGroup.<init>(JRFillElementGroup.java:88) at net.sf.jasperreports.engine.fill.JRFillElementContainer.<init>(JRFillElementContainer.java:88) at net.sf.jasperreports.engine.fill.JRFillBand.<init>(JRFillBand.java:77) at net.sf.jasperreports.engine.fill.JRFillObjectFactory.getBand(JRFillObjectFactory.java:374) at net.sf.jasperreports.engine.fill.JRFillGroup.<init>(JRFillGroup.java:76) at net.sf.jasperreports.engine.fill.JRFillObjectFactory.getGroup(JRFillObjectFactory.java:353) at net.sf.jasperreports.engine.fill.JRFillVariable.<init>(JRFillVariable.java:83) at net.sf.jasperreports.engine.fill.JRFillObjectFactory.getVariable(JRFillObjectFactory.java:333) at net.sf.jasperreports.engine.fill.JRFillDataset.addVariable(JRFillDataset.java:275) at net.sf.jasperreports.engine.fill.JRFillDataset.setVariables(JRFillDataset.java:265) at net.sf.jasperreports.engine.fill.JRFillDataset.<init>(JRFillDataset.java:219) at net.sf.jasperreports.engine.fill.JRFillObjectFactory.getDataset(JRFillObjectFactory.java:1032) at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:374) at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:92) at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:74) at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:147) at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:83) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:601) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:517) at it.businesslogic.ireport.IReportCompiler.run(IReportCompiler.java:653) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.ClassNotFoundException: BarChartCustomizer at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at net.sf.jasperreports.engine.util.JRClassLoader.loadClassForName(JRClassLoader.java:90) at net.sf.jasperreports.engine.fill.JRFillChart.<init>(JRFillChart.java:260) ... 23 more Print not filled. Try to use an EmptyDataSource...! By: Fek - fekmfg RE: Setting a chart's range?? 2006-05-12 07:03 Hi, I have the same problem I need to set the x axis from 0 to 24. Is there no possibility to configure the axis? Greetings Fek By: Marcelo Fernandes - mcf-rocha RE: Setting a chart's range?? 2006-05-29 08:46 Hi all! I want to do the same thing. Have you found the solution? I know how to do it in JasperReport but not in iReport: final JFreeChart chart = ChartFactory.createBarChart3D( "Graph name", // chart title "Domain name", // domain axis label "Range name", // range axis label dataset, // data PlotOrientation.HORIZONTAL, // orientation true, // include legend true, // tooltips false // urls ); final CategoryPlot plot = chart.getCategoryPlot(); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); //Now we set the range, for exemple: from 0 to 5 rangeAxis.setRangeWithMargins(0,5); Thanks in advance, Marcelo By: bill - rx7haze RE: Setting a chart's range?? 2006-05-30 06:17 Someone out there must know how to use the customizer class. Please help. Thanks. Link to comment Share on other sites More sharing options...
rx7haze Posted October 7, 2006 Share Posted October 7, 2006 I finally figured out my problem. Mostly has to do with lack of experience with java. When using the sample report and the sample BarChartCustomizer, I did not realize you needed to compile the BarChartCustomizer.java file. So the file I need to point to is BarChartCustomizer.class. Along with the classpath pointing to directory housing this file. It works wonderful. Link to comment Share on other sites More sharing options...
yosh Posted November 8, 2006 Share Posted November 8, 2006 Hi! After having around the same problem but wanting to enable non-programmers to design such a report with a range-option I programmed it as a "patch" into iReport and into Jasper (currently against v1.2.7). I'm now able to enter an optional Range setting for linecharts which enables me to put in a 0-100 range for example to have a percent chart "visualized". Contact me if somebody wants it too... Regards, Thorsten B) Link to comment Share on other sites More sharing options...
burasami Posted November 23, 2006 Share Posted November 23, 2006 :( hello can i know how to include the file "patch" into iReport and JasperReports.. thanks in advance Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted November 23, 2006 Share Posted November 23, 2006 Hi yosh, this looks like a common problem (and a solution to a common problem). Why don't donate the code to the projects :-) We'll be happy to add this feature to JR/iR Giulio Link to comment Share on other sites More sharing options...
yosh Posted November 23, 2006 Share Posted November 23, 2006 I've posted the diffs as a Patch inside the tracker for the iReport module. Regards, Thorsten B) Link to comment Share on other sites More sharing options...
teodord Posted November 23, 2006 Share Posted November 23, 2006 Hi, Thorsten I think we are going to do something about it for an upcoming release.Just by looking at the patch file, I think it would be better if the range limits would be report expressions and not hardcoded double values. We'll take care of that when we decide to implement it. Thank you,Teodor Link to comment Share on other sites More sharing options...
yosh Posted November 23, 2006 Share Posted November 23, 2006 Hi Teodor! Yes - the code can or really should be stabilized or generalized. The patch is the result of a half-day code review of both Jasper and iReport - Sources. I'll (for myself) will take a look at what report expressions will mean. Is that an abstract class? Maybe in the hurry with implementing that I just missed the data surroundings! :-) Regards, Thorsten p.s.: Greetings to Ken B.! :-) Link to comment Share on other sites More sharing options...
burasami Posted November 27, 2006 Share Posted November 27, 2006 when i am trying to use this following java code for setting a chart range..final JFreeChart chart = ChartFactory.createBarChart3D( "Graph name", // chart title "Domain name", // domain axis label "Range name", // range axis label dataset, // data PlotOrientation.HORIZONTAL, // orientation true, // include legend true, // tooltips false // urls ); final CategoryPlot plot = chart.getCategoryPlot(); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); //Now we set the range, for exemple: from 0 to 5 rangeAxis.setRangeWithMargins(0,5); i am getting error: "the type org.jfree.util.public cloneable cannot be resolved. it is indirectly referenced from required class file" can any one help me?thanks in advance Link to comment Share on other sites More sharing options...
yosh Posted November 27, 2006 Share Posted November 27, 2006 Looks like the classpath is missing a class out of the JCommon - Project. Try downloading the required JAR from (http://www.jfree.org/jcommon/download/) and put it into the classpath.This will help you I think.But I'm wondering for whatever reason the creator requires that lib... anyway, I didn't test 3d charts yet :-). :woohoo: Regards, Thorsten Link to comment Share on other sites More sharing options...
burasami Posted November 29, 2006 Share Posted November 29, 2006 hai.. yosh thanks for ur reply..now error is gone. i have include that class file(eg xxxx.class) in chart property-->customizer as "xxxx.class". i have converted this class file as jar file and included in option-->classpath-->addjar->"xxx.jar".. when i am running that "xxxx.jrxml". its give an classnot found error..as "xxx.class" is not found one more thing you have to clarify me.."Graph name", // chart title "Domain name", // domain axis label "Range name", // range axis label dataset, // can u clarify me.. how to give value for arguments at run time from iReport.. i am using iRepot-1.2.4 thanks in advance:( Link to comment Share on other sites More sharing options...
yosh Posted November 29, 2006 Share Posted November 29, 2006 Hi! A) I talked about CLASSPATH and not about class extraction out of the jar! Therefore I expected that you put the JAR file into your projects or iReports classpath.Nevertheless I haven't been playing around with 3d chart stuff and this is probably not even the right thread for the upcoming problems :-). B) Maybe it's possible to put in Parameter $P{foobar} things inside the fields of the graph legends.Didn't try that yet. Regards, Thorsten Link to comment Share on other sites More sharing options...
Rachel07 Posted October 16, 2007 Share Posted October 16, 2007 hi yosh, Can I have the code for setting the range? Link to comment Share on other sites More sharing options...
yosh Posted October 20, 2007 Share Posted October 20, 2007 Rachel07, Just take a look at the tracker for iReport... http://jasperforge.org/sf/sfmain/do/go/artf1821 B) Be careful - I haven't been working (really unfortunately) on JasperReports since one year as I changed my employment a bit though the patch is still against the 1.2.7. Maybe Teodor knows if there is now a feature enabling exactly what my "quick and dirty" patch did. Regards, Thorsten 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