Developer404
Developer404

Reputation: 5962

Display label on top of Bar chart in JFree

I want to display the labels on top of the bar in a multi series chart using JFree. Please tell me how to accomplish this?

Upvotes: 4

Views: 5158

Answers (2)

Jupiter Jones
Jupiter Jones

Reputation: 863

I think you mean the legend, that can be easily placed on top in this way:

LegendTitle legend = chart.getLegend();
legend.setPosition(RectangleEdge.TOP);

Upvotes: -1

trashgod
trashgod

Reputation: 205805

As this is a bar chart, add an instance of StandardCategoryItemLabelGenerator to your plot's renderer. See the source for the meaning of elements in the labelFormat string. Here's a related example using StandardXYItemLabelGenerator.

Upvotes: 5

Related Questions