Report chart hides bar value labels when update BarRenderer

This is doable, but you have to set the label generator to your custom renderer and then set its visibility to true. You will get the result you are looking for if you change your commented code to look like this:

	class CustomRenderer(BarRenderer):
		def getItemPaint(self, row, column):
			cntValue = chart.getCategoryPlot().getDataset().getValue(row, column)
			inRange = cntValue > mTarget-chartValueLimiter and cntValue < mTarget+chartValueLimiter
			return Color.green if inRange else Color.red
	chart.getCategoryPlot().setRenderer(CustomRenderer())
	modifiedRenderer = chart.getCategoryPlot().getRenderer()
	modifiedRenderer.setBaseItemLabelGenerator(labelGenerator)
	modifiedRenderer.setBaseItemLabelsVisible(True)

This code gets the modified renderer after it has been set, and subsequently applies the desired labels using the label generator that you already have in place in line 21 of your code.

2 Likes