I have created a report (which uses line chart) in iReport and using JasperReports libraries to print the report in my web application.
I am using the customizer class to customize few options in the line chart. Now because that class is common across all the charts.
Now some of my charts has 2 series and someone them has only 1.
Is there any way I can know the no of series in my class.
The below is the sample class. I want to set their shape for all the series to the same.
public class LineChartCustomizer implements JRChartCustomizer {
private static Log log = LogFactory.getLog(LineChartCustomizer.class);
@Override
public void customize(JFreeChart jFreeChart, JRChart jrChart) {
CategoryPlot plot = jFreeChart.getCategoryPlot();
LineAndShapeRenderer renderer = new LineAndShapeRenderer();
renderer.setSeriesShape(0, ShapeUtilities.createDiamond(1F));
//Need help in above to loop through total no of series instead of hard coding to 0
//This is so that the value of X axis starts from 0 and does not leave any space
plot.getDomainAxis().setLowerMargin(0.01);
plot.getDomainAxis().setUpperMargin(0.01);
plot.setRenderer(renderer);
}
}