Jump to content
We've recently updated our Privacy Statement, available here ×

Chart Question


ntobik

Recommended Posts

I have a few questions in regards to the chart tool functionality in iReport.

 

1. On a bar chart, is there any way to make the category text labels angled at the bottom? Currently my dates are cut off with a ..., I'd like them to be at a 45 deg angle if possible so everything will be visible.

 

2. Is there any way to specify specific colors for the charts? I need all my charts to use the same colors throughout the reports so it's consistent.

 

3. How do you use a customizer class within the chart tool? I have the manual and it mentions it briefly, but I'd like more details or a simple example if possible. Thank you.

 

Nate

Link to comment
Share on other sites

  • Replies 8
  • Created
  • Last Reply

Top Posters In This Topic

I ended up solving all of my problems and I thought I should share with everyone else how I did it.

 

JRChartCustomizer...

 

You implement that interface and it gives you access to the JFreeChart object, you can modify the object to your hearts content and all of the changes will be rendered in with the report. Let me know if anyone runs into any problems.

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 year later...

Code:
public class FirstCustomizer implements JRChartCustomizer {
public void customize(JFreeChart chart, JRChart jasperChart) {
BarRenderer renderer = (BarRenderer) chart.getCategoryPlot()
.getRenderer();
CategoryPlot plot = chart.getCategoryPlot();
CategoryAxis cata = plot.getDomainAxis();

 

The code above should be a good starting point. Specify the full name of this class as the customizer class.

Link to comment
Share on other sites

  • 1 year later...
  • 1 month later...
  • 5 months later...

Hi

This is Amit. Can u tell me how to give path of the JRChartCustomizer class in the chart tool properties (Customizer Class).

I found error as

ErrorÂfillingÂprint...ÂCouldÂnotÂcreateÂchartÂcustomizerÂinstance.

net.sf.jasperreports.engine.JRRuntimeException:ÂCouldÂnotÂcreateÂchartÂcustomizerÂinstance. ÂÂÂÂatÂnet.sf.jasperreports.engine.fill.JRFillChart.<init>(JRFillChart.java:326) ÂÂÂÂatÂnet.sf.jasperreports.engine.fill.JRFillObjectFactory.getChart(JRFillObjectFactory.java:582) ÂÂÂÂatÂnet.sf.jasperreports.engine.base.JRBaseChart.getCopy(JRBaseChart.java:552) ÂÂÂÂatÂnet.sf.jasperreports.engine.fill.JRFillElementGroup.<init>(JRFillElementGroup.java:88) ÂÂÂÂatÂnet.sf.jasperreports.engine.fill.JRFillElementContainer.<init>(JRFillElementContainer.java:90) ÂÂÂÂatÂnet.sf.jasperreports.engine.fill.JRFillBand.<init>(JRFillBand.java:83) ÂÂÂÂatÂnet.sf.jasperreports.engine.fill.JRFillObjectFactory.getBand(JRFillObjectFactory.java:385) ÂÂÂÂatÂnet.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:432) ÂÂÂÂatÂnet.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:77) ÂÂÂÂatÂnet.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:59) ÂÂÂÂatÂnet.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:147) ÂÂÂÂatÂnet.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:57) ÂÂÂÂatÂnet.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402) ÂÂÂÂatÂnet.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:234) ÂÂÂÂatÂit.businesslogic.ireport.IReportCompiler.run(IReportCompiler.java:934) ÂÂÂÂatÂjava.lang.Thread.run(UnknownÂSource) CausedÂby:Âjava.lang.ClassNotFoundException:Âtest ÂÂÂÂ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.loadClassForRealName(JRClassLoader.java:132) ÂÂÂÂatÂnet.sf.jasperreports.engine.util.JRClassLoader.loadClassForName(JRClassLoader.java:72) ÂÂÂÂatÂnet.sf.jasperreports.engine.fill.JRFillChart.<init>(JRFillChart.java:323) ÂÂÂÂ...Â15Âmore

Link to comment
Share on other sites

  • 2 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...