Bar Chart 3D Single Series with Different Color

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
jFreeChartUser25
Posts: 3
Joined: Mon Mar 28, 2011 9:03 pm
antibot: No, of course not.

Bar Chart 3D Single Series with Different Color

Post by jFreeChartUser25 » Tue Mar 29, 2011 6:43 pm

Hello,

I have been struggling with this problem for sometime now. I am interested in creating a Bar Chart that is 3D and only has one series. I want each bar to have a different color. At the moment I can generate the Bar Chart 3D that I want except every bar has the same color. An example of this is located at the following link since I'm not able to add any attachments to this post:

https://docs.google.com/leaf?id=0BwUy2S ... y=CLbfhesH

Additionally, the code to generate the above graph is the following:

Code: Select all

DefaultCategoryDataset datasetASO = new DefaultCategoryDataset();
datasetASO.setValue( 80, "A001", "PS11");
datasetASO.setValue( 70, "A001", "PS12");
datasetASO.setValue( 60, "A001", "PS13");
datasetASO.setValue( 50, "A001", "PS14");
datasetASO.setValue( 40, "A001", "PS15");

FreeChart barChartASO = ChartFactory.createBarChart3D("Approching Sold-Out", "", "% Sold",  datasetASO, PlotOrientation.VERTICAL, true, true, rue);

// Create the rendering info
ChartRenderingInfo infoSE = new ChartRenderingInfo( new StandardEntityCollection() );
// Setup the path
String strNewFileNameASO = getServletContext().getRealPath("/") + ""+ "SessionEventTop.PNG";
// Create the file
File fileASO = new File(strNewFileNameASO);
// Now, save the chart
ChartUtilities.saveChartAsPNG(fileASO, barChartASO, 300, 300, infoSE);

Does anyone know how to change the bar colors to each be different in a series?

Locked