Jump to content

Recommended Posts

Posted

I have a report with several subreports, some of which have graphs. I'm trying to implement a class to set a theme on this graphs, but i'm not seeing any changes. The class looks as follows:

package chartThemes;import java.awt.Color;import org.jfree.chart.JFreeChart;import org.jfree.chart.axis.ValueAxis;import org.jfree.chart.plot.XYPlot;import net.sf.jasperreports.engine.JRChart;import net.sf.jasperreports.engine.JRChartCustomizer;public class ChartThemeTest implements JRChartCustomizer {@Override public void customize(JFreeChart chart, JRChart jasperChart) {  XYPlot plot=chart.getXYPlot();    ValueAxis rangeAxis=plot.getRangeAxis();    rangeAxis.setMinorTickCount(4);  rangeAxis.setMinorTickMarkOutsideLength(1.0f);  rangeAxis.setMinorTickMarksVisible(true);    rangeAxis.setTickMarkOutsideLength(2.5f);  jasperChart.setBackcolor(new Color(150, 20, 30));    jasperChart.setForecolor(new Color(204, 0, 0)); }}[/code]

I'm using iReport 5.6.0, and as far as I can see, it loads the .jar successfully (if I mess the class name in the properties editor of the graph in iReport, it gives an error while creating the chart). But when I compile and create the PDF, the chart has the same properties setted in the iReport, instead of the properties setted in the java class.

Any suggestion?

EDIT: I tried adding a title through chart.setTitle(<title>), and the title appeared in the final report, so I'm guessing that the class is being read, but i'm missing something to make the jasperChart changes to occur.

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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...