I want to change colors of the bar chart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
vairamuthum
Posts: 9
Joined: Tue Jul 11, 2006 8:10 am
Location: Delhi
Contact:

I want to change colors of the bar chart

Post by vairamuthum » Fri Jul 14, 2006 10:14 am

Hi Dave and all,
I am Vairamuthu working as a trainee programmer.Actually i got a bar chart from my friend.W have to create some dashboards.So only focussing on JFREE.It's new to us.But we hope this suits for our requirement.But at the starting i had a doubt to change the color of bars.Where i can find solution for that.what i have to do to know fully about jfree chart.I am new to this...........i am really interrested in knowing that.........I want to be good in jfree charts.i need ur help dave and my new colleagues in jfree............Presently going thro the forums posted by our colleagues....


Regards
Vairamuthu M

cenicienta
Posts: 15
Joined: Mon Jun 26, 2006 8:31 pm
Location: Paris

Post by cenicienta » Tue Jul 18, 2006 8:22 am

Try something like that :

Code: Select all

		java.awt.Color[] color = new java.awt.Color[10];
		color[0] = java.awt.Color.cyan;
		color[1] = java.awt.Color.green;
		color[2] = java.awt.Color.blue;
		color[3] = java.awt.Color.orange;
		color[4] = java.awt.Color.gray;
		color[5] = java.awt.Color.pink;
		color[6] = java.awt.Color.magenta ;
		color[7] = java.awt.Color.red ;
		color[8] = java.awt.Color.darkGray ;
		color[9] = java.awt.Color.yellow ;

		BarRenderer renderer = new BarRenderer();
		for (int i = 0; i < color.length; i++)
		{
			renderer.setSeriesPaint(i,color[i]);
		}
		CategoryPlot plot = new CategoryPlot(dataset,categoryAxis,valueAxis,renderer);

Locked