I don;t want space betwwin items of barchart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
asha
Posts: 3
Joined: Mon May 14, 2007 12:03 pm

I don;t want space betwwin items of barchart

Post by asha » Mon May 14, 2007 12:06 pm

Hi,

I used setItemMargin method but depending on number of bars distance between bars changes..

But I want no space between bars..

anyone can help me reply ASAP
AM

Andrew Foss
Posts: 36
Joined: Thu Apr 12, 2007 6:54 am

Post by Andrew Foss » Mon May 14, 2007 1:01 pm

I would like to hear if there is an answer to this.

Best I've been able to do is make the space small w/ setting margin to zero and increasing the stroke of the line the series w/ setStroke. Increasing the stroke doesn't help if using gradient paints, though...

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Tue May 15, 2007 10:24 am

You can set the item margin in the renderer and the category margin on the axis. See "Controlling the Width of Bars" in the BarRenderer section of the JFreeChart Developer Guide.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Andrew Foss
Posts: 36
Joined: Thu Apr 12, 2007 6:54 am

Post by Andrew Foss » Tue May 15, 2007 3:10 pm

This is what I'm doing, still big gaps between the bars as they get packed in tight. I was thinking that maybe I was drawing a bar outline in white, but doesn't look that way...

XYBarRenderer r1 = new XYBarRenderer();
r1.setMargin(0);

DateAxis domain1Axis = new DateAxis(xaxis1name);

domain1Axis.setAutoRange(true);
domain1Axis.setLowerMargin(0);
domain1Axis.setUpperMargin(0);

pradheep
Posts: 15
Joined: Thu Apr 12, 2007 4:47 am
Location: Chennai [INDIA]
Contact:

Re: I don;t want space betwwin items of barchart

Post by pradheep » Wed May 23, 2007 12:20 pm

asha wrote:Hi,

I used setItemMargin method but depending on number of bars distance between bars changes..

But I want no space between bars..

anyone can help me reply ASAP
u r talking abt the height of each bar and the spacing. if u really got it let me know. i am desperately in need of that.

PraDz
--------------------------------
Cheers
PraDz

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Thu May 24, 2007 10:19 am

Andrew Foss wrote: XYBarRenderer r1 = new XYBarRenderer();
r1.setMargin(0);
The XYBarRenderer determines the width of the bars from the values returned by the IntervalXYDataset - the starting x-value and the ending x-value. It may then shrink that interval a little according to the margin setting, but you've set that to zero already. So you need to look at your dataset values and figure out why the ending x-value from one data item (bar) isn't aligning with the starting x-value for the next data item (bar).
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Andrew Foss
Posts: 36
Joined: Thu Apr 12, 2007 6:54 am

That will do it thanks...

Post by Andrew Foss » Thu May 24, 2007 1:27 pm

I'm using a timeseries and don't have much control over the sampling rate, but I can duplicate samples, each of which is an 3 minute average, so I can fill up the 3 minute slot w/ average numbers, thank you.

I also did a modified XYRendererFill that fills below and allows gradient paint and I get the desired result that way, also, which is a smoothly filled in chart.

Locked