# Add text on gantt chart and change background color of tooltip

**URL:** <https://forum.inductiveautomation.com/t/add-text-on-gantt-chart-and-change-background-color-of-tooltip/93327>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [July 17, 2024, 10:55am UTC](https://forum.inductiveautomation.com/t/add-text-on-gantt-chart-and-change-background-color-of-tooltip/93327 "2024-07-17T10:55:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sakshi\_Gupta](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@Sakshi\_Gupta](https://forum.inductiveautomation.com/u/Sakshi_Gupta)\
**Post date:** [July 17, 2024, 10:55am UTC](https://forum.inductiveautomation.com/t/add-text-on-gantt-chart-and-change-background-color-of-tooltip/93327/1 "2024-07-17T10:55:58Z")

</div>

I have plotted gantt chart using XY chart in ignition perspective. While i have added all the information that i need to see on the tooltip but at the same time i want few of those information to appear on my gantt chart readily(since the tooltip information is visible only if i hover over it. Can someone help me to achieve it?Also i have applied a particular color to my gantt chart and i can see the tooltip taking the same color, i need to change the background color of tooltip , how to do that?

![image (3)](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/c/ec39799d942985209881c613223c1e7df24e79b6.png)

---

<div class="post-metadata">

**Author:** ![Ujwal\_Wankhede](https://avatars.discourse-cdn.com/v4/letter/u/4af34b/32.png) [@Ujwal\_Wankhede](https://forum.inductiveautomation.com/u/Ujwal_Wankhede)\
**Post date:** [July 18, 2024, 4:20am UTC](https://forum.inductiveautomation.com/t/add-text-on-gantt-chart-and-change-background-color-of-tooltip/93327/2 "2024-07-18T04:20:00Z")

</div>

Everything you mentioned is achievable.

 ![XY Chart Tooltip background and Labels](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/2/92cfcebf10147b524628ab46b451ece0504f7ecc.png)

Add additional series for each purpose

1. Main series for the columns
2. Label series to add text inside the column
3. Tooltip background series to render a different tooltip color.

Adjust multiple properties in each series, xAxes and yAxes to make everything work.  
Refer to attached XY for complete details  
[XY Chart Custom Tooltip background and lables.json](https://forum.inductiveautomation.com/uploads/short-url/3j0T0es4TyfYjCrfc0uZyvWk2SE.json) (34.8 KB)

@IA there is a prop available to change the background color of a tooltip but its not working. Is it a bug? [Perspective - XY Chart | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/appendix/components/perspective-components/perspective-chart-palette/perspective-xy-chart#seriestooltipbackground)

---

<div class="post-metadata">

**Author:** ![Sakshi\_Gupta](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@Sakshi\_Gupta](https://forum.inductiveautomation.com/u/Sakshi_Gupta)\
**Post date:** [July 18, 2024, 4:56am UTC](https://forum.inductiveautomation.com/t/add-text-on-gantt-chart-and-change-background-color-of-tooltip/93327/3 "2024-07-18T04:56:40Z")

</div>

I dont want to have static text on the gantt chart , the information that is seen on tooltip is fetched from database using sql query .Like for example if there are 5 information on the tooltip , so 2 from them i want to show on bar of gantt chart.  
Also even after adding the color in the background option in the tooltip i dont see that the color has changed.  
Please let me know how can that be achieved.

---

<div class="post-metadata">

**Author:** ![Ujwal\_Wankhede](https://avatars.discourse-cdn.com/v4/letter/u/4af34b/32.png) [@Ujwal\_Wankhede](https://forum.inductiveautomation.com/u/Ujwal_Wankhede)\
**Post date:** [July 18, 2024, 5:44am UTC](https://forum.inductiveautomation.com/t/add-text-on-gantt-chart-and-change-background-color-of-tooltip/93327/4 "2024-07-18T05:44:14Z")

</div>

> [@Sakshi\_Gupta](#):
>
> I dont want to have static text on the gantt chart , the information that is seen on tooltip is fetched from database using sql query .Like for example if there are 5 information on the tooltip , so 2 from them i want to show on bar of gantt chart.

Transform the data from the db to create the custom string for the tooltip label. Add the new value to a unique key in the dataSources array. Assign this key to the series rendering line.  
`Label` is the key in the example. Assigned to `[1].line.appearance.bullets.label.text`  
Note that the `line.appearance.stroke.opacity` and `line.appearance.fill.opacity` of this series is 0 to hide the lines. This series is used only for the column labels.

> [@Sakshi\_Gupta](#):
>
> Also even after adding the color in the background option in the tooltip i dont see that the color has changed.

In my example the `series[0].tooltip.enabled` is false. Series[2] used for the tooltip is a replica of [0] but with the following changes.

```python
series[2].zIndex : 1
series[2].tooltip.enabled : true
series[2].column.appearance.stroke.opacity : 0
series[2].column.appearance.fill.opacity : 0
series[2].deriveFieldsFromData.fill.color : Tooltip_Background

```

(Tooltip\_Background is the key of the background color you want)

Go through the details of the example, and you will get the starting point.

---

<div class="post-metadata">

**Author:** ![Sakshi\_Gupta](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@Sakshi\_Gupta](https://forum.inductiveautomation.com/u/Sakshi_Gupta)\
**Post date:** [July 18, 2024, 6:30am UTC](https://forum.inductiveautomation.com/t/add-text-on-gantt-chart-and-change-background-color-of-tooltip/93327/5 "2024-07-18T06:30:25Z")

</div>

is it necessary that Tooltip\_Background is to be given in the dataset?

---

<div class="post-metadata">

**Author:** ![Ujwal\_Wankhede](https://avatars.discourse-cdn.com/v4/letter/u/4af34b/32.png) [@Ujwal\_Wankhede](https://forum.inductiveautomation.com/u/Ujwal_Wankhede)\
**Post date:** [July 18, 2024, 6:54am UTC](https://forum.inductiveautomation.com/t/add-text-on-gantt-chart-and-change-background-color-of-tooltip/93327/6 "2024-07-18T06:54:10Z")

</div>

If it will be static then no. Remove that property.  
Assign the tooltip background color to `series[2].column.appearance.fill.color`

---

<div class="post-metadata">

**Author:** ![Sakshi\_Gupta](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@Sakshi\_Gupta](https://forum.inductiveautomation.com/u/Sakshi_Gupta)\
**Post date:** [July 18, 2024, 6:57am UTC](https://forum.inductiveautomation.com/t/add-text-on-gantt-chart-and-change-background-color-of-tooltip/93327/7 "2024-07-18T06:57:11Z")

</div>

yes im doing that , but i can see it automatically taking the color of the bar of the gantt chart, like if i give the bars red color then tooltip bg is red , and if i change it to blue then again the bg of tooltip changes to blue

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/5/f515cce422fcb29e4f39a90be791385a593e416b.png)

here i have given column color as green and tooltip bg as black , but i see green for both

---

<div class="post-metadata">

**Author:** ![Ujwal\_Wankhede](https://avatars.discourse-cdn.com/v4/letter/u/4af34b/32.png) [@Ujwal\_Wankhede](https://forum.inductiveautomation.com/u/Ujwal_Wankhede)\
**Post date:** [July 18, 2024, 8:54am UTC](https://forum.inductiveautomation.com/t/add-text-on-gantt-chart-and-change-background-color-of-tooltip/93327/8 "2024-07-18T08:54:28Z")

</div>

I think you are using common series to render column and tooltip.  
My posted example use two different series. First for column which has tooltip disable and another for tooltip.
