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?
Try adding an offset to the label anchor:
categoryPlot.getRenderer().setItemLabelAnchorOffset(10.0d);