Legends in Bar chart

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

Legends in Bar chart

Post by hgeeks » Wed Jul 24, 2002 8:07 pm

Hi,

I need your help... I have a code that generate a Bar Chart (simple code), this is:

.
.
.
JFreeChart jfcChart;

Double[][] data = (Double[][])arlData.get(0);
String[] serie = (String[])arlData.get(1);
String[] labels = (String[])arlData.get(2);
Object[] category = labels;

DefaultCategoryDataset dcdDataset = new DefaultCategoryDataset(data);
dcdDataset.setSeriesNames(serie);
dcdDataset.setCategories(category);

CategoryDataset cdData = dcdDataset;

jfcChart = ChartFactory.createStackedVerticalBarChart ((String)arlData.get(3), (String)arlData.get(4), (String)arlData.get(5), cdData, true);
jfcChart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 1000, 0, Color.white));
.
.
.

how I can put labels on each Bar?

thanks...

Regards.

David Gilbert

Re: Legends in Bar chart

Post by David Gilbert » Wed Jul 24, 2002 10:22 pm

I'm pretty sure that you can't display labels for each bar in a stacked bar chart. If you want to modify the code, the place to draw the labels would be in the drawCategoryItem(...) method in the StackedVerticalBarRenderer or the StackedHorizontalBarRenderer class (depending on the orientation of the chart you are using).

Regards,

DG.

hgeeks

Re: Legends in Bar chart

Post by hgeeks » Wed Jul 24, 2002 11:31 pm

Thanks David,

but I don't understand very well... look:

| 5
| * 4
| * 3 *
| * * *
| * * * 1
| * * * *
-------------------------------------------

I need puy values on the top foe each bar, is it possible with my code or I need use other class?...

where I find documentation for JfreeChart?...

thanks, again...

Regards
Hgeeks

Locked