Minimum BAR Width of XYBar Chart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
ranyeng
Posts: 13
Joined: Fri May 22, 2009 6:53 am

Minimum BAR Width of XYBar Chart

Post by ranyeng » Fri Oct 09, 2009 9:34 am

Following is part of my code creating a bar chart:

.......................
for(int k=0;k<numR;k++){
dataset.addValue(Double.valueOf(filteredData[k]), xArrayData[k], ""+k);
}
................................

When the XY bar graph is created the width of the bar is very small just like a small line. I wanted to fix the minimum width of the bar say 1 cm. How can I do it?


Thanks in advance;


Ranjan Yengkom

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

Re: Minimum BAR Width of XYBar Chart

Post by david.gilbert » Thu Oct 15, 2009 8:58 pm

The XYBarRenderer derives the bar width from the dataset's getStartXValue() and getEndXValue() methods. Which dataset implementation are you using? Maybe you can override the x-interval values...
David Gilbert
JFreeChart Project Leader

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

jet
Posts: 4
Joined: Thu Aug 05, 2010 3:16 pm
antibot: No, of course not.

Re: Minimum BAR Width of XYBar Chart

Post by jet » Tue Aug 10, 2010 3:40 pm

Hi, i'm using XYBarRenderer and i dont know how can i set fixed bar with. Setting bar width in percentage is not good, because sometimes i have data like [1.121 1.122 1.123 1.124] and sometimes like [83 84 85] so

Code: Select all

renderer.setMargin(0.99);
is not cool in my case because with different data i have different bar width, so could someone explain to me how can i solve this?
Thanx)

skunk
Posts: 1087
Joined: Thu Jun 02, 2005 10:14 pm
Location: Brisbane, Australia

Re: Minimum BAR Width of XYBar Chart

Post by skunk » Tue Aug 10, 2010 4:43 pm

XYBarDataset defines this method

Code: Select all

public void setBarWidth(double barWidth)

jet
Posts: 4
Joined: Thu Aug 05, 2010 3:16 pm
antibot: No, of course not.

Re: Minimum BAR Width of XYBar Chart

Post by jet » Wed Aug 11, 2010 9:22 am

thanx, so how about XYSeriesCollection. is there any way to set fixed width, i'm totally cofused about it right now :?

Locked