Reporting top 10 bar chart colors

How do I make each bar a different color for a top 10 graph in a report?

I found this where you can change the color based on the value in the scripting(below) and it works fine for that but I can’t figure out how to make it work for my case.


from org.jfree.chart.renderer.category import BarRenderer
from java.awt import Color
class myBarRenderer(BarRenderer):
	def getItemPaint(self, row, column):
		v = chart.getCategoryPlot().getDataset().getValue(row, column)
		if v < 70:
plot = chart.getCategoryPlot()

*Edited so it actually made sense.

I edited my original post because after I read it again it was not very clear.

Use the row or column (I can’t remember which, probably row) as an index into a constant list of colors. I suggest placing the code in a script module so the bulk of it only executes once.