# Perspective XY Chart tooltip calculated value

**URL:** <https://forum.inductiveautomation.com/t/perspective-xy-chart-tooltip-calculated-value/90212>\
**Category:** Ignition\
**Tags:** perspective, scripting, ignition81\
**Created:** [May 10, 2024, 7:25am UTC](https://forum.inductiveautomation.com/t/perspective-xy-chart-tooltip-calculated-value/90212 "2024-05-10T07:25:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![davee\_s](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@davee\_s](https://forum.inductiveautomation.com/u/davee_s)\
**Post date:** [May 10, 2024, 7:25am UTC](https://forum.inductiveautomation.com/t/perspective-xy-chart-tooltip-calculated-value/90212/1 "2024-05-10T07:25:09Z")

</div>

Hi guys, I have a Perspective project with a XY chart that represents seconds on the Y axys of some events that happen on the plant.  
What I wish is to display in the tooltip the seconds like HH:mm:ss, for example if the value is 3600 seconds, the tooltip should represent 01:00:00.  
I have a script that generates the trendStyle but I can't reach this goal.

Thanks

 ![Screenshot 2024-05-10 092040](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/0/90d540cae7e1f4d6bfd7ddefb50ad5e3c005f6e0.png)  
 ![Screenshot 2024-05-10 092420](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/2/5281044f359a830fd6c2c3466d72cce4bb4f6a71.png)

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [May 10, 2024, 8:24am UTC](https://forum.inductiveautomation.com/t/perspective-xy-chart-tooltip-calculated-value/90212/2 "2024-05-10T08:24:20Z")

</div>

I spent quite a while figuring out how to beat the XY Chart tooltips into shape. I documented it all on the forum. Read through it and you might find a solution.

> [@Perspective XY Chart xAxes tooltip text {dateX}](https://forum.inductiveautomation.com/t/perspective-xy-chart-xaxes-tooltip-text-datex/53580/8):
>
> Just only add new line and it working \n not functionally

---

<div class="post-metadata">

**Author:** ![davee\_s](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@davee\_s](https://forum.inductiveautomation.com/u/davee_s)\
**Post date:** [May 14, 2024, 7:03am UTC](https://forum.inductiveautomation.com/t/perspective-xy-chart-tooltip-calculated-value/90212/3 "2024-05-14T07:03:59Z")

</div>

Thanks @Transistor I fixed. Now I have another problem with tooltip position. As you can see, if I hover on a bullet line, the tooltip goes over the container and it is "cutted". Is there a way to show the complete tooltip independently of the bullet position?

Thanks

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

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [May 14, 2024, 7:34am UTC](https://forum.inductiveautomation.com/t/perspective-xy-chart-tooltip-calculated-value/90212/4 "2024-05-14T07:34:22Z")

</div>

Possible workarounds:

1. Force `yAxes.0.value.range.max` to a higher value to open up a little space. This breaks your auto-scaling.
2. Add `style.paddingTop : 40` (or whatever).

---

<div class="post-metadata">

**Author:** ![davee\_s](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@davee\_s](https://forum.inductiveautomation.com/u/davee_s)\
**Post date:** [May 14, 2024, 8:45am UTC](https://forum.inductiveautomation.com/t/perspective-xy-chart-tooltip-calculated-value/90212/5 "2024-05-14T08:45:19Z")

</div>

Solved showing only few values that fits in the tooltip. Another question: is there a way to hide yAxis when clicking on a trend legend? I would like to show/hide yAxis based on trend legend

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [May 14, 2024, 9:04am UTC](https://forum.inductiveautomation.com/t/perspective-xy-chart-tooltip-calculated-value/90212/6 "2024-05-14T09:04:50Z")

</div>

No, I don't think any of those properties are exposed.

Workaround: create your own legends outside the chart with checkboxes or toggle switches and bind each `yAxes.x.visible` to the boolean tags.

Another possibility is to use labels for the legends and use onMouseEnter and onMouseLeave to enable the visibility. Watch out for reliability issues if the onMouseLeave event doesn't fire for any reason. (I don't know why I suspect this might be a problem. Just a hunch.)
