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

JFree Bar Chart


zain.nabi

Recommended Posts

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

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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