# Stacked bar chart - percentage

**URL:** <https://forum.inductiveautomation.com/t/stacked-bar-chart-percentage/21564>\
**Category:** Ignition\
**Created:** [December 21, 2018, 11:10am UTC](https://forum.inductiveautomation.com/t/stacked-bar-chart-percentage/21564 "2018-12-21T11:10:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matrix\_Engineering](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matrix_engineering/32/19781_2.png) [@Matrix\_Engineering](https://forum.inductiveautomation.com/u/Matrix_Engineering)\
**Post date:** [December 21, 2018, 11:10am UTC](https://forum.inductiveautomation.com/t/stacked-bar-chart-percentage/21564/1 "2018-12-21T11:10:28Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [December 21, 2018, 4:14pm UTC](https://forum.inductiveautomation.com/t/stacked-bar-chart-percentage/21564/2 "2018-12-21T16:14:59Z")

</div>

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()`](http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/plot/CategoryPlot.html#getRenderer-int-) is zero indexed. On that renderer, you will need to [`setSeriesItemLabelGenerator()`](http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/renderer/category/CategoryItemRenderer.html#setSeriesItemLabelGenerator-int-org.jfree.chart.labels.CategoryItemLabelGenerator-) to provide a new…item label generator. Your item label generator will need to be a new class that either implements the [`CategoryItemLabelGenerator`](http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/labels/CategoryItemLabelGenerator.html) interface directly, or subclasses the [`StandardCategoryItemLabelGenerator`](http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/labels/StandardCategoryItemLabelGenerator.html).
