# Change color of one point in a XYChart

**URL:** <https://forum.inductiveautomation.com/t/change-color-of-one-point-in-a-xychart/24745>\
**Category:** Ignition\
**Tags:** ignition79, scripting\
**Created:** [May 7, 2019, 1:43pm UTC](https://forum.inductiveautomation.com/t/change-color-of-one-point-in-a-xychart/24745 "2019-05-07T13:43:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![c.bertulli](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@c.bertulli](https://forum.inductiveautomation.com/u/c.bertulli)\
**Post date:** [May 7, 2019, 1:43pm UTC](https://forum.inductiveautomation.com/t/change-color-of-one-point-in-a-xychart/24745/1 "2019-05-07T13:43:51Z")

</div>

Hi All,

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 🙂

Cheers,

---

<div class="post-metadata">

**Author:** ![c.bertulli](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@c.bertulli](https://forum.inductiveautomation.com/u/c.bertulli)\
**Post date:** [May 10, 2019, 8:07am UTC](https://forum.inductiveautomation.com/t/change-color-of-one-point-in-a-xychart/24745/2 "2019-05-10T08:07:06Z")

</div>

Nobody? 😥

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [May 10, 2019, 8:06pm UTC](https://forum.inductiveautomation.com/t/change-color-of-one-point-in-a-xychart/24745/3 "2019-05-10T20:06:43Z")

</div>

Something like this should do the trick.

```auto
	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())

```

---

<div class="post-metadata">

**Author:** ![c.bertulli](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@c.bertulli](https://forum.inductiveautomation.com/u/c.bertulli)\
**Post date:** [May 13, 2019, 12:08pm UTC](https://forum.inductiveautomation.com/t/change-color-of-one-point-in-a-xychart/24745/4 "2019-05-13T12:08:31Z")

</div>

Thanks!! 👍👍

For posterity:  
row is the series  
column is the item
