Bars don't centre in statistical bar charts

A free public discussion forum for the JFreeChart class library.

Bars don't centre in statistical bar charts

Postby esb » Fri Jun 19, 2009 9:18 am

I have the problem that the bars are not centred in statistical bar charts with standard deviation indicators. I found out that it happens when you use the StatisticalBarRenderer.setMaximumBarWidth() method to make bars thinner than the automatic width. If you don't have many categories it aligns the bars to the left of the category area. Therefore the bar is not above the category label. It's like JFreeChart puts the standard deviation column not only in the SD indicator but also in an invisible bar beside the actual bar. Is this a bug or is there any way to avoid this and centre the bars normally in the middle?
esb
 
Posts: 9
Joined: Tue May 26, 2009 12:40 pm
Location: The Netherlands

Re: Bars don't centre in statistical bar charts

Postby david.gilbert » Mon Jun 22, 2009 1:25 pm

This is a bug, thanks for the report. I've added an entry in the bug tracker:

https://sourceforge.net/tracker/?func=d ... tid=115494
david.gilbert
JFreeChart Project Leader
 
Posts: 11352
Joined: Fri Mar 14, 2003 10:29 am

Re: Bars don't centre in statistical bar charts

Postby esb » Mon Jun 22, 2009 1:33 pm

Thanks David. I thought so that it was a bug. I hope it will be fixed in 1.0.14.
esb
 
Posts: 9
Joined: Tue May 26, 2009 12:40 pm
Location: The Netherlands

Re: Bars don't centre in statistical bar charts

Postby david.gilbert » Tue Jun 23, 2009 12:44 pm

esb wrote:Thanks David. I thought so that it was a bug. I hope it will be fixed in 1.0.14.


Hopefully, but I have a project on right now so I might not get it done for 1.0.14. I think the StatisticalBarRenderer class should be refactored so that it just leaves the BarRenderer class to draw the bars, and then overlays the lines indicating the standard deviation after that. But until I study the code in detail I don't know if that will be practical or not (if not, the bar drawing code should at least be copied from the BarRenderer class).
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited
david.gilbert
JFreeChart Project Leader
 
Posts: 11352
Joined: Fri Mar 14, 2003 10:29 am

Re: Bars don't centre in statistical bar charts

Postby esb » Tue Jun 23, 2009 1:19 pm

Maybe you could also consider adding functionality for drawing asymmetrical indicators with normal bars and lines? For instance with minimum and maximum values that lie with different distances from the mean value or with skewed distributions. I would really like to be able to use that. The same would apply to the StatisticalLineAndShapeRenderer class then. The dataset class could contain two additional columns for the minimum and maximum values of the indicator (instead of one additional column for the SD like with the DefaultStatisticalCategoryDataset).
esb
 
Posts: 9
Joined: Tue May 26, 2009 12:40 pm
Location: The Netherlands


Return to JFreeChart - General

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Yahoo [Bot] and 7 guests