# Bar Chart (stacked) - How to hide labels if they equal zero

**URL:** <https://forum.inductiveautomation.com/t/bar-chart-stacked-how-to-hide-labels-if-they-equal-zero/12299>\
**Category:** Ignition\
**Created:** [October 27, 2016, 8:26pm UTC](https://forum.inductiveautomation.com/t/bar-chart-stacked-how-to-hide-labels-if-they-equal-zero/12299 "2016-10-27T20:26:16Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [October 28, 2016, 2:50pm UTC](https://forum.inductiveautomation.com/t/bar-chart-stacked-how-to-hide-labels-if-they-equal-zero/12299/2 "2016-10-28T14:50:15Z")

</div>

[code]from org.jfree.chart.labels import StandardCategoryItemLabelGenerator

class myLabelGenerator(StandardCategoryItemLabelGenerator):  
def generateLabel(self,dataset,series, category):   
value = dataset.getValue(series,category)   
if value == 0:  
return None  
else:  
return str(int(value))

chart = event.source.parent.getComponent(‘Bar Chart’).getChart()  
plot = chart.getPlot()  
renderer = plot.getRenderer()  
renderer.setItemLabelGenerator(myLabelGenerator())  
renderer.setItemLabelsVisible(True)[/code]

---

_[View the full topic](https://forum.inductiveautomation.com/t/bar-chart-stacked-how-to-hide-labels-if-they-equal-zero/12299)._
