问题
I have made it possible for value labels to appear on top of the bar in JFreeChart. However, it would look better if the labels are inside the bars. How do I make this work? The image below shows what I wanted the graph to look like.

回答1:
I used the following code to make it work:
StackedBarRenderer renderer = new StackedBarRenderer(false);
renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
renderer.setBaseItemLabelsVisible(true);
chart.getCategoryPlot().setRenderer(renderer);`
回答2:
Just specify the desired ItemLabelPosition in your CategoryItemLabelGenerator. BarChartDemo3 is an example, shown here.
回答3:
You can use ItemLabelPosition DOC Here
renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12,TextAnchor.TOP_CENTER ))
Output :-

来源:https://stackoverflow.com/questions/7155294/jfreechart-bar-graph-labels