Labels in StackedVerticalBarChart

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

Labels in StackedVerticalBarChart

Post by hgeeks » Mon Jul 29, 2002 7:21 pm

Hi,

I noticed in 0.9.2 there is a method on the CategoryPlot class called setLabelsVisible()...

This does make labels visible at the top of Vertical Bar Charts...

Exist the same functionality for StackedVerticalBarChart?...

Thanks.

Hgeeks

David Gilbert

Re: Labels in StackedVerticalBarChart

Post by David Gilbert » Mon Jul 29, 2002 10:59 pm

There isn't any code to display labels in the stacked bar charts (yet).

Regards,

DG.

Iain Crawford

Re: Labels in StackedVerticalBarChart

Post by Iain Crawford » Tue Jul 30, 2002 8:56 pm

I implemented a solution in the drawCategory Method. SImple but proved to be effective - and follows the initial implmenetation for normal bar charts

if (plot.getLabelsVisible()) {
Font labelFont = plot.getLabelFont();
g2.setFont(labelFont);
Paint paint = plot.getLabelPaint();
g2.setPaint(paint);
String dvalue = String.valueOf(value);
g2.drawString(dvalue, (float)(rectX + (rectWidth/3)), (float)(bar.getCenterY() + 3));
}

Locked