# Gantt Chart Tooltips

**URL:** <https://forum.inductiveautomation.com/t/gantt-chart-tooltips/69444>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [February 4, 2023, 12:18am UTC](https://forum.inductiveautomation.com/t/gantt-chart-tooltips/69444 "2023-02-04T00:18:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aaron\_Shivne](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@Aaron\_Shivne](https://forum.inductiveautomation.com/u/Aaron_Shivne)\
**Post date:** [February 4, 2023, 12:18am UTC](https://forum.inductiveautomation.com/t/gantt-chart-tooltips/69444/1 "2023-02-04T00:18:50Z")

</div>

I am making use of the Gantt Chart in Vision and I am looking for a way to change the information in the mouse over tooltip.

Currently it will show the Row/task and show the time span in a (mmm, d, yyyy) format. My chart is only showing tasks that all occur on the same day so I would prefer the tooltip to display the time span as hh:mm:ss format.

Attempting to use the example from this post:

> [@Getting and Setting Bar Chart tooltips](https://forum.inductiveautomation.com/t/getting-and-setting-bar-chart-tooltips/10754):
>
> Is there a way to override the functionality for the bar chart’s tooltips? I’m trying to find a way to change what is displayed when you mouse over one of the bars. I was hoping there would be an easy way to find what the default value would be, change it, and then write back the text I want. The getToolTipText() and setToolTipText() functions get and set the Mouseover Text, which is what appears when your mouse is not over a bar. Is there a feature in here that I’m missing?

Except not getting any results.

Any tips?

---

<div class="post-metadata">

**Author:** ![Aaron\_Shivne](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@Aaron\_Shivne](https://forum.inductiveautomation.com/u/Aaron_Shivne)\
**Post date:** [February 4, 2023, 2:35am UTC](https://forum.inductiveautomation.com/t/gantt-chart-tooltips/69444/2 "2023-02-04T02:35:41Z")

</div>

Simply reformatting my query to only get the Time portion of the Datetime data is not accepted by the Gantt chart, which requires a Datetime for the Start and End Time data.

---

<div class="post-metadata">

**Author:** ![Aaron\_Shivne](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@Aaron\_Shivne](https://forum.inductiveautomation.com/u/Aaron_Shivne)\
**Post date:** [February 4, 2023, 3:10am UTC](https://forum.inductiveautomation.com/t/gantt-chart-tooltips/69444/3 "2023-02-04T03:10:29Z")

</div>

I've managed to change the tooltip using the code from the example, slightly changed and placed in the property change script. Its returning integer values for all 3 variables below.  
Where my dataset (multiply rows, 4 columns) has "String", Datetime, Datetime, Integer

```auto
from org.jfree.chart.labels import CategoryToolTipGenerator
	
class CustomToolTipGenerator(CategoryToolTipGenerator):
	def generateToolTip(self,dataset,row,column):
		task = dataset.getValue(0,0)
		start = dataset.getValue(0,1)
		end = dataset.getValue(0,2)
		return "%s, %s, %s"%(task,start,end)
	
chart = event.source.getChart()
renderer = chart.getPlot().getRenderer()
renderer.setToolTipGenerator(CustomToolTipGenerator())

```

---

<div class="post-metadata">

**Author:** ![Aaron\_Shivne](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@Aaron\_Shivne](https://forum.inductiveautomation.com/u/Aaron_Shivne)\
**Post date:** [February 7, 2023, 6:26pm UTC](https://forum.inductiveautomation.com/t/gantt-chart-tooltips/69444/4 "2023-02-07T18:26:30Z")

</div>

With the above code the result I am getting looks like this:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/1/416710e092f8abfc5987a34bb7f9555c4ef8fb14.png)

Would be nice if there was simple method for formatting the default tooltip.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 7, 2023, 6:29pm UTC](https://forum.inductiveautomation.com/t/gantt-chart-tooltips/69444/5 "2023-02-07T18:29:23Z")

</div>

Those three numbers are milliseconds UTC (jfreechart likes numbers in its datasets). Use `system.date.fromMillis()` to make date objects, and then format those as you see fit with `system.date.format...`.

---

<div class="post-metadata">

**Author:** ![Aaron\_Shivne](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@Aaron\_Shivne](https://forum.inductiveautomation.com/u/Aaron_Shivne)\
**Post date:** [February 8, 2023, 12:11am UTC](https://forum.inductiveautomation.com/t/gantt-chart-tooltips/69444/6 "2023-02-08T00:11:30Z")

</div>

Thanks that worked out. I am still having some issues now with dataset.getValue function.

dataset.getValue(0,0) is returning a time value as well when in the dataset it is a string value.  
Also trying dataset.getValue(Row,0) nothing happens.

When I view the client I get the new tooltips only some of the times, so I am not sure if my property change script is calling itself when I would like it to.
