changing bar "thickness"

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

changing bar "thickness"

Post by Peter Hanson » Tue Oct 09, 2001 5:02 pm

Hello, All

I'm a newbie JFreeChart user, and I was wondering if someone could answer the question of changing the thickness of a bar in the bar charts.

When I have only two bars, they are much too thick for a good presentation. I tried changing the IntroGap, CategoryGap, TrailGap settings, but they seem to have no effect.

Any suggestions?

Thanks in advance.

Peter

David Gilbert

RE: changing bar "thickness"

Post by David Gilbert » Wed Oct 10, 2001 8:57 am

Peter,

You're on the right trail - the SeriesGap, CategoryGap, IntroGap and TrailGap attributes (in the BarPlot class) are the only things that give you control over the width of the bars in a chart.

I'm not entirely happy with the way this works, but at the moment I can't think of a better way to do it and still have the charts look reasonable across a range of different sizes.

Suggestions are welcome!

Regards,

DG.

Peter Hanson

RE: changing bar "thickness"

Post by Peter Hanson » Wed Oct 10, 2001 1:24 pm

Greetings, David

Thanks for the fast reply. After a deeper search into the forum, I discovered the proper code. Here it is, for other people who might be curious:

BarPlot myBarPlot = (BarPlot)chart.getPlot();
myBarPlot.setIntroGap(50);
myBarPlot.setTrailGap(50);
myBarPlot.setCategoryGap(50);

I had tried by creating a HorizontalBarPlot object, but my settings had no effect.

Thanks.

Peter

Peter Hanson

How-To: Preserving space after removing legend

Post by Peter Hanson » Wed Oct 10, 2001 3:01 pm

Hello again,

I was wondering how one might preserve some padding on the right hand side of the chart after you set the legend to null?

With the legend removed, the final tick value is crammed against the right side.

Any ideas on getting back some padding?

Cheers,

Peter

Locked