a Learner
a Learner

Reputation: 5042

Label on bars in JFreeChart Bar Graph

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...

Upvotes: 0

Views: 5655

Answers (2)

trashgod
trashgod

Reputation: 205875

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.

Upvotes: 2

Jes
Jes

Reputation: 2778

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.

Upvotes: 3

Related Questions