BarChart Display Problem (without use series&category)

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
onderulker
Posts: 13
Joined: Mon May 22, 2006 3:01 pm

BarChart Display Problem (without use series&category)

Post by onderulker » Thu Nov 23, 2006 7:21 pm

Hi all;

I have a problem a bit complicated :)

First of all I have three diffirent dataset. I took them by 'data = new JDBCCategoryDataset()' function.

I want to create a bar chart and insert these three dataset into chart.

/********************************/
JFreeChart chart = null;

try {

Class object = ChartFactory.class;
Method method = object.getMethod(methodName,param);
chart = (JFreeChart) method.invoke(method,paramValues);

} catch (SecurityException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
/********************************/

I have created related chart.

After than I have inserted second and third category datasets by this for loop;

/********************************/
for (int i=1; i<catDataset.length;i++){

plot.setDataset(i,catDataset);
BarRenderer render = new BarRenderer ();
plot.setRenderer(i, render);

}
/********************************/

As a result I have taken this chart ; (bar behind each others)

http://docs.google.com/View?docid=ddw99tpn_49cq2w93


but I want to create a chart like this;
http://docs.google.com/View?docid=ddw99tpn_55dh89tq

My datasets which I took from DB;

/************************/

'2004-03-01', 2151
'2004-04-01', 2932
'2004-05-01', 3607
'2004-06-01', 4487
'2004-07-01', 5757
'2004-08-01', 6153
'2004-09-01', 6588
'2004-10-01', 7781
'2004-11-01', 8175
'2004-12-01', 8562
'2005-01-01', 9920
'2005-02-01', 10172
'2005-03-01', 11462
'2005-04-01', 12752
'2005-05-01', 13181
'2005-06-01', 14161
'2005-07-01', 14247
'2005-08-01', 15079
'2005-09-01', 15195
'2005-10-01', 15597

/***********************/

'2004-03-01', 1660
'2004-04-01', 2480
'2004-05-01', 3130
'2004-06-01', 4220
'2004-07-01', 5340
'2004-08-01', 6390
'2004-09-01', 7410
'2004-10-01', 8420
'2004-11-01', 9430
'2004-12-01', 10440
'2005-01-01', 11372
'2005-02-01', 12304
'2005-03-01', 13406
'2005-04-01', 14516
'2005-05-01', 15616
'2005-06-01', 16716
'2005-07-01', 17816
'2005-08-01', 18930
'2005-09-01', 20034
'2005-10-01', 21128

/************************/

'2004-03-01', 1176
'2004-04-01', 1986
'2004-05-01', 2842
'2004-06-01', 3617
'2004-07-01', 4565
'2004-08-01', 5453
'2004-09-01', 6388
'2004-10-01', 7216
'2004-11-01', 8006
'2004-12-01', 9012
'2005-01-01', 10780
'2005-02-01', 11959
'2005-03-01', 13267
'2005-04-01', 14483
'2005-05-01', 15723
'2005-06-01', 16894
'2005-07-01',
'2005-08-01',
'2005-09-01',
'2005-10-01',

Locked