zain.nabi Posted May 2, 2019 Share Posted May 2, 2019 I have created a bar chart using Jasper Studio. The bars currently are thin and and all have a different colour. How do I set each bar to a width of 1cm and all the same colour. Please view current image of the graph. Also herewith is my customizer class in which I created in Eclipse:package Customizer import org.jfree.chart.JFreeChart; import net.sf.jasperreports.engine.JRChart;import net.sf.jasperreports.engine.JRChartCustomizer; public class CustomLegendList implements JRChartCustomizer{ public void customize(JFreeChart chart, JRChart jrChart){ CategoryPlot cplot = (CategoryPlot)chart.getPlot(); cplot.setBackgroundPaint(SystemColor.inactiveCaption);//change background color //set bar chart color ((BarRenderer)cplot.getRenderer()).setBarPainter(new StandardBarPainter());BarRenderer r = (BarRenderer)chart.getCategoryPlot().getRenderer(); r.setSeriesPaint(0, Color.blue); } } 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