# Diagram Gantt change color property Complete color

**URL:** <https://forum.inductiveautomation.com/t/diagram-gantt-change-color-property-complete-color/52876>\
**Category:** Ignition\
**Created:** [November 9, 2021, 2:42pm UTC](https://forum.inductiveautomation.com/t/diagram-gantt-change-color-property-complete-color/52876 "2021-11-09T14:42:31Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![stefano.sforna](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@stefano.sforna](https://forum.inductiveautomation.com/u/stefano.sforna)\
**Post date:** [November 9, 2021, 2:42pm UTC](https://forum.inductiveautomation.com/t/diagram-gantt-change-color-property-complete-color/52876/1 "2021-11-09T14:42:31Z")

</div>

Hi,  
I want to have different color for property Complete Color for each bar of Gantt diagram.

Is it possible???

Thank You

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [November 9, 2021, 2:46pm UTC](https://forum.inductiveautomation.com/t/diagram-gantt-change-color-property-complete-color/52876/2 "2021-11-09T14:46:07Z")

</div>

[https://docs.inductiveautomation.com/display/DOC81/XY+Chart+Example+-+Gantt+Chart](https://docs.inductiveautomation.com/display/DOC81/XY+Chart+Example+-+Gantt+Chart)

> 11 Our data includes a key for color, but our chart isn't currently using it. Set **series[0].column.deriveFieldsFromData.fill.color** to "color". This will map the "color" key in our data source to each block in the chart..

---

<div class="post-metadata">

**Author:** ![stefano.sforna](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@stefano.sforna](https://forum.inductiveautomation.com/u/stefano.sforna)\
**Post date:** [November 9, 2021, 3:09pm UTC](https://forum.inductiveautomation.com/t/diagram-gantt-change-color-property-complete-color/52876/3 "2021-11-09T15:09:43Z")

</div>

I used component Gantt Chart in Vision, not XY chart used as Gantt chart…

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 9, 2021, 3:39pm UTC](https://forum.inductiveautomation.com/t/diagram-gantt-change-color-property-complete-color/52876/4 "2021-11-09T15:39:40Z")

</div>

JFreeChart’s [`GanttRenderer`](https://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/renderer/category/GanttRenderer.html#setCompletePaint-java.awt.Paint-) only supports a single complete color. It might be possible to subclass `GantRenderer` yourself, by implementing the `configureChart` extension function (if you’re on a version new enough to have it), but it’s going to take some doing.

---

<div class="post-metadata">

**Author:** ![stefano.sforna](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@stefano.sforna](https://forum.inductiveautomation.com/u/stefano.sforna)\
**Post date:** [November 9, 2021, 4:00pm UTC](https://forum.inductiveautomation.com/t/diagram-gantt-change-color-property-complete-color/52876/5 "2021-11-09T16:00:42Z")

</div>

Do you have an example???

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 9, 2021, 5:23pm UTC](https://forum.inductiveautomation.com/t/diagram-gantt-change-color-property-complete-color/52876/6 "2021-11-09T17:23:37Z")

</div>

It’s not trivial. This is about as much time as I’m willing to spend; you have to ‘cache’ the task you’re looking at in one function and reference it in another:

```auto
	from org.jfree.chart.renderer.category import GanttRenderer
	
	class CustomGanttRenderer(GanttRenderer):
		def __init__ (self):
			self.columnsToColors = {
				"First Task": system.gui.color(255, 0, 0),
				"Second Task": system.gui.color(128, 128, 128),
				"Third Task": system.gui.color(0, 0, 255),
			}
			self.currentColumn = None
			
		def drawTasks(self, graphics, state, dataArea, plot, domainAxis, rangeAxis, dataset, row, col):
			self.currentColumn = dataset.getColumnKey(col)
			self.super__drawTasks(graphics, state, dataArea, plot, domainAxis, rangeAxis, dataset, row, col)
			
		def getCompletePaint(self):
			return self.columnsToColors.get(self.currentColumn, self.super__getCompletePaint())	
	
	chart.plot.renderer = CustomGanttRenderer()

```

---

<div class="post-metadata">

**Author:** ![stefano.sforna](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@stefano.sforna](https://forum.inductiveautomation.com/u/stefano.sforna)\
**Post date:** [November 11, 2021, 3:14pm UTC](https://forum.inductiveautomation.com/t/diagram-gantt-change-color-property-complete-color/52876/7 "2021-11-11T15:14:19Z")

</div>

![gantt_diagram](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/c/fc2eb4a5d4c164dff86b8273b2b9d6c06f764d77.jpeg)  
Thank you for response,  
Your code work well.  
Another question: How is possible to delete orange border in each bar???

Thank You

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 11, 2021, 4:53pm UTC](https://forum.inductiveautomation.com/t/diagram-gantt-change-color-property-complete-color/52876/8 "2021-11-11T16:53:38Z")

</div>

Perhaps call [`self.setDrawBarOutline(False)`](https://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/renderer/category/BarRenderer.html#setDrawBarOutline-boolean-) in ` __init__ `.

---

<div class="post-metadata">

**Author:** ![stefano.sforna](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@stefano.sforna](https://forum.inductiveautomation.com/u/stefano.sforna)\
**Post date:** [November 11, 2021, 4:59pm UTC](https://forum.inductiveautomation.com/t/diagram-gantt-change-color-property-complete-color/52876/9 "2021-11-11T16:59:41Z")

</div>

> [@paul-griffith](#):
>
> [`self.setDrawBarOutline(False)`](https://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/renderer/category/BarRenderer.html#setDrawBarOutline-boolean-)

I try, but not work
