I want to change the color of some point inside a Chart component. I tried myself but I’m not so familiar with Java ( yet ).
After a lot of Googleing around I know I have to determine which renderer class is being used ( org.jfree.chart.renderer.xy.StandardXYItemRenderer ) and create a subclass of it where override the getItemPaint() method to return a specific color for the data item that I wish to highlight, but I don’t know how to do it
Any help would be much much appreciated
from org.jfree.chart.renderer.xy import StandardXYItemRenderer
from java.awt import Color
class myXYItemRenderer(StandardXYItemRenderer):
def getItemPaint(self,row,column):
#whatever criteria you want to use to determine color
if row == 0 and column >= 12:
return Color.BLACK
else:
return StandardXYItemRenderer.getItemPaint(self,row,column)
chart.getXYPlot().setRenderer(myXYItemRenderer())