# Mouse Hover over XY chart to obtain the X axis value

**URL:** <https://forum.inductiveautomation.com/t/mouse-hover-over-xy-chart-to-obtain-the-x-axis-value/77110>\
**Category:** Ignition\
**Created:** [July 30, 2023, 1:15pm UTC](https://forum.inductiveautomation.com/t/mouse-hover-over-xy-chart-to-obtain-the-x-axis-value/77110 "2023-07-30T13:15:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![chaoliang](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@chaoliang](https://forum.inductiveautomation.com/u/chaoliang)\
**Post date:** [July 30, 2023, 1:15pm UTC](https://forum.inductiveautomation.com/t/mouse-hover-over-xy-chart-to-obtain-the-x-axis-value/77110/1 "2023-07-30T13:15:33Z")

</div>

I have a xy chart, like below.  
When the mouse hovers over each bar, is there any way I can obtain the x axis value (1....44) of the bar?  
Not sure which event should I trigger on the XY chart?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/8/788734287b44a925ab21408253868329cd9acb73.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:** [July 30, 2023, 1:39pm UTC](https://forum.inductiveautomation.com/t/mouse-hover-over-xy-chart-to-obtain-the-x-axis-value/77110/2 "2023-07-30T13:39:13Z")

</div>

Have a look at what I wrote in the link below. In my case the X-axis value was a date. It looks like you are using a category so you may need to experiment.

> [@Perspective XY Chart xAxes tooltip text {dateX}](https://forum.inductiveautomation.com/t/perspective-xy-chart-xaxes-tooltip-text-datex/53580/10):
>
> An example tooltip with date, time and day of week. [XY Chart tooltip with time] Machine: [bold]{name}[/] Count: [bold]{valueY}[/] Date: [bold]{dateX.formatDate('yyyy-MMM-dd')}[/] Time: [bold]{dateX.formatDate('HH:mm EEE')}[/]

See the link to the AM Charts documentation for further ideas.

---

<div class="post-metadata">

**Author:** ![chaoliang](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@chaoliang](https://forum.inductiveautomation.com/u/chaoliang)\
**Post date:** [August 5, 2023, 12:39pm UTC](https://forum.inductiveautomation.com/t/mouse-hover-over-xy-chart-to-obtain-the-x-axis-value/77110/3 "2023-08-05T12:39:29Z")

</div>

Thanks. I went through your post, it works well for the tooltip modification. After adding the {categoryX} I can see the index value when hovering over each bar.

But I have difficulty to take out the {categoryX} value, which is the index value I want to take, and link this value to a separate label component.

I tried to link the property or creating a custom property, to link the tooltip text, it shows only the static string "{categoryX}", not the actual value.

---

<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:** [August 5, 2023, 12:42pm UTC](https://forum.inductiveautomation.com/t/mouse-hover-over-xy-chart-to-obtain-the-x-axis-value/77110/4 "2023-08-05T12:42:02Z")

</div>

See my answer to your duplicate question.

> [@X-Value in XY Chart Bullet Tooltip](https://forum.inductiveautomation.com/t/x-value-in-xy-chart-bullet-tooltip/29998/8):
>
> You can't. This was explained by PGriffith above in post 5.

---

<div class="post-metadata">

**Author:** ![chaoliang](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@chaoliang](https://forum.inductiveautomation.com/u/chaoliang)\
**Post date:** [August 5, 2023, 12:47pm UTC](https://forum.inductiveautomation.com/t/mouse-hover-over-xy-chart-to-obtain-the-x-axis-value/77110/5 "2023-08-05T12:47:57Z")

</div>

Thanks.

It looks like there is no way to extract the {categoryX} value from the XY chart.

---

<div class="post-metadata">

**Author:** ![chaoliang](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@chaoliang](https://forum.inductiveautomation.com/u/chaoliang)\
**Post date:** [August 5, 2023, 12:56pm UTC](https://forum.inductiveautomation.com/t/mouse-hover-over-xy-chart-to-obtain-the-x-axis-value/77110/6 "2023-08-05T12:56:52Z")

</div>

get some idea from the following post.

> [@Get value from hovered slice in a Pie Chart](https://forum.inductiveautomation.com/t/get-value-from-hovered-slice-in-a-pie-chart/41205):
>
> Anyone knows how to get the value from the currently hovered slice in a pie chart? In the below figure, the value 21438 should be collected, and written to a custom property in e.g. another component: [image] Ignition version 8.1.0 Thanks!

by enabling the selection, I can now get the index value.  
the format is:

```auto
../XYChart.props.selection.data[0].index

```

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/2/42abb56e9e081fd87be1fbf4404672799e6bc7c4.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:** [August 5, 2023, 1:07pm UTC](https://forum.inductiveautomation.com/t/mouse-hover-over-xy-chart-to-obtain-the-x-axis-value/77110/7 "2023-08-05T13:07:52Z")

</div>

I never spotted that before - and I've used XY Chart many times.  
It looks like you have to actually select - not just hover.

Thanks for the update.
