0
votes

Please consider following graph : enter image description here

The above bar graph is built using jfreechart. I have two questions:

1) Values (1,5,4 etc.)are printed on the top but within the bars.How to display these on the top but above the bars?

2)Each value is printed on the bars in horizontal manner. How to display them in proper vertical manner?

Thanks...

2
BarChartDemo8 is an example. - trashgod
@trashgod: there are lot of examples there but source code is missing. - a Learner

2 Answers

3
votes

You should take a look at ItemLabelPosition, as explained here.

It is a property on the BarRenderer for the given chart. Try experimenting with the different values for the desired result.

2
votes

Expanding on @Jes's helpful suggestion, you can see how ChartFactory.createBarChart() uses ItemLabelPosition in the relevant source code. More on the label generator parameters may be found here.