How to show labels on top of bar with some space in jasper report?

I am working on a jasper report in which I am using java customizers to make some changes in the chart look. In my report I am creating a bar chart which looks like below:

Here I am using following code to show labels on top of bars:

CategoryPlot plot = (CategoryPlot)chart.getPlot();
BarRenderer barRenderer = (BarRenderer)plot.getRenderer();
CategoryPlot categoryPlot = (CategoryPlot) chart.getPlot();
categoryPlot.getRenderer().setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER));

I want to increase the space between top of bars and labels. I am not getting a way to do this. Can someone suggest me how to do this?

Answers


Try adding an offset to the label anchor:

categoryPlot.getRenderer().setItemLabelAnchorOffset(10.0d);

Need Your Help

PHP connect to SQL not giving error message

php sql ado

I am trying to use PHP to connect to my SQL database using

Regular expression search during Vim replace

vim replace

I have many lines in my script that look like: