Vertical Bar Chart Issues

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Suprigya

Vertical Bar Chart Issues

Post by Suprigya » Thu Oct 24, 2002 9:08 pm

Hi,

Could someone please tell me why this piece of code is not drawing vertical bar chart.

I want each bar color to be of different color. Since, each series displays all bars in same color, I am creating individual series for each bar chart. But, it displays line charts instead of bars.

I tried creating bar chart with just one series also, but it displayed line chart for that also.

public JFreeChart createBarChart( DataSet dataSet )
{
// create a dataset...
double[][] data = new double[][] {
{ 1.0, 0.0, 0.0},
{ 0.0, 7.0, 0.0 },
{ 0.0, 0.0, 2.0 }
};

DefaultCategoryDataset dataCat = new DefaultCategoryDataset(data);
// set the category names...
String[] categories = new String[] { "A", "B", "C };
dataCat .setCategories(categories);

//create chart with xAxisTitle, yAxis Title. No legend
return ChartFactory.createVerticalBarChart( "", "xAxisTitle" , "yAxisTitle", dataCat ,false );
}

Suprigya

Re: Vertical Bar Chart Issues

Post by Suprigya » Thu Oct 24, 2002 10:45 pm

please ignore this. I found out the problem. It was picking
LineAndShapeRenderer instead of VerticalBarRenderer.

Locked