Hi all,
I am using JFreeChart for creating bar charts - vertical bar charts, horizontal bar charts, 3D Bar charts, and 3D Stacked Bar charts.
When I have more data the chart is very good, but when I have less data say 1 or 2 data only the bar covers the whole chart and are very big bars.
I wish some one of you help me in getting a decent good chart even when I have less data.
Regards
Girish
Controlling bar width for bar charts
Re: Controlling bar width for bar charts
It will require some modification to JFreeChart to make it handle small numbers of bars differently. But if you have the chance to intervene in your own code, you can change the values of these attributes (all in the CategoryPlot class) to alter the bar widths:
- introGapPercent
- trailGapPercent
- itemGapsPercent
- categoryGapsPercent
The bar widths are automatically calculated to use whatever space is available after the above amounts have been distributed across the chart as the "gaps".
Regards,
DG.
- introGapPercent
- trailGapPercent
- itemGapsPercent
- categoryGapsPercent
The bar widths are automatically calculated to use whatever space is available after the above amounts have been distributed across the chart as the "gaps".
Regards,
DG.
Re: Controlling bar width for bar charts
Hi DG,
Thanks.
Had to do lots of calculations to check how much data I have before setting the gaps.
Some times if there are 2 data (2 bars would be displayed), and I set maximum gaps then therewas no bars at all.
Any way this helped me.
Thanks
Girish
Thanks.
Had to do lots of calculations to check how much data I have before setting the gaps.
Some times if there are 2 data (2 bars would be displayed), and I set maximum gaps then therewas no bars at all.
Any way this helped me.
Thanks
Girish