Category bar chart - How to remove the gradient?

I have a chart component that I’ve configured a category chart on. The renderer is set to stacked bar. By default the bars have a gradient on them. I’d like to remove the gradient and just have flat colors. From what I’ve found searching for removing the gradient from a jfreechart categoryplot it looks like I need to set the barPainter to the StandardBarPainter style but I’m not entirely sure how to do that. Has anyone done this before?

Put this in the configureChart extension function.

	from org.jfree.chart.renderer.category import StandardBarPainter

	plot = chart.getPlot()
	plot.getRenderer().setBarPainter(StandardBarPainter())
3 Likes

Thank you! Just in case anyone else needs it, I added one more line to remove the shadow.

	from org.jfree.chart.renderer.category import StandardBarPainter

	plot = chart.getPlot()
	renderer = plot.getRenderer()
	renderer.setBarPainter(StandardBarPainter())
	renderer.setShadowVisible(0)

3 Likes