I have a 3-stack bar chart in report module. Currently have bar labels shown. For the first part of the stack, I want the figure as is now, it’s shown in metres. For the other two parts of the stack, I want the figure not expressed in metres but as a percentage of the total. Being dynamic, I can’t just put a static label on as one day there could be 5 rows returned the next 15. I’m guessing some custom scripting on the bar chart component would get what I want - any advice on how to proceed?
From the CategoryPlot
(chart.getPlot()
) you will need to get the renderer for the series you are trying to customize (based on your description, there should be 3 series total; getRenderer()
is zero indexed. On that renderer, you will need to setSeriesItemLabelGenerator()
to provide a new…item label generator. Your item label generator will need to be a new class that either implements the CategoryItemLabelGenerator
interface directly, or subclasses the StandardCategoryItemLabelGenerator
.