I noticed in 0.9.2 there is a method on the CategoryPlot class called setLabelsVisible()
This does make labels visible at the top of Vertical Bar Charts - pritty effective.
It kind of works on Horizontal Bar Charts but attempts to put the values rather than following the bar but actually above it - which means the first value can not appear in the graph or it may be 'hidden' by another bar - is there any way to make it appear alongside?
Also this feature does not appear to be available/work for the StackedBar Charts - if there were plans to make labels appear that would be a great help to me or is there something I can do in the meantime to get that capability?
Thanks
Labels on BarChart Based Graphs
Re: Labels on BarChart Based Graphs
Hi Iain,
The code that draws the bar labels for the horizontal bar chart is in the drawCategoryItem method in the HorizontalBarRenderer class. I forget who added this, but it looks like it could do with an adjustment to the text positioning calculation. It would be good if it would take into account the font size and label width also.
You could probably add some similar code to the StackedHorizontalBarRenderer class to get labels on stacked horizontal bar charts.
Regards,
DG.
The code that draws the bar labels for the horizontal bar chart is in the drawCategoryItem method in the HorizontalBarRenderer class. I forget who added this, but it looks like it could do with an adjustment to the text positioning calculation. It would be good if it would take into account the font size and label width also.
You could probably add some similar code to the StackedHorizontalBarRenderer class to get labels on stacked horizontal bar charts.
Regards,
DG.
Re: Labels on BarChart Based Graphs
Thanks for the reponse.
Yeah it looks like the stacked bar chart values have become a major requirement for me and I will be looking at writing some code to do that. My main issue is how to judge if there is enough space to actually draw a value (for example the stack shows only 1%)
And I may play about with the alignments and the ability to add leading $ or trailing % on vertical and horizontal bar charts in general - though whats there suffices in the short term
Any advice with stacked issues would be great
Iain
Yeah it looks like the stacked bar chart values have become a major requirement for me and I will be looking at writing some code to do that. My main issue is how to judge if there is enough space to actually draw a value (for example the stack shows only 1%)
And I may play about with the alignments and the ability to add leading $ or trailing % on vertical and horizontal bar charts in general - though whats there suffices in the short term
Any advice with stacked issues would be great
Iain
Re: Labels on BarChart Based Graphs
I now have some sample code that works effectively for stacked bars - and an improvement on horizontal bars - showing the values.
I have changed the color scheme used for Stacked Bars as the Blue in particular causes problems viewing the values.
Should I just put the code samples here?
Iain
I have changed the color scheme used for Stacked Bars as the Blue in particular causes problems viewing the values.
Should I just put the code samples here?
Iain