# ChartJS onClick parameters

**URL:** <https://forum.servoy.com/t/chartjs-onclick-parameters/23892>\
**Category:** Questions\
**Created:** [March 11, 2025, 2:32pm UTC](https://forum.servoy.com/t/chartjs-onclick-parameters/23892 "2025-03-11T14:32:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bodnarescu.diana](https://avatars.discourse-cdn.com/v4/letter/b/87869e/32.png) [@bodnarescu.diana](https://forum.servoy.com/u/bodnarescu.diana)\
**Post date:** [March 11, 2025, 2:32pm UTC](https://forum.servoy.com/t/chartjs-onclick-parameters/23892/1 "2025-03-11T14:32:27Z")

</div>

Hello,

I am currently using ChartJS 2024.3.2 with Servoy 2024.3.5.3948\_LTS.  
I have encountered an issue with the onClick event of a bar chart where the dataset\_index and index parameters consistently return the following values:  
dataset\_index: 0  
index: null  
However, when I check the value of context.dataIndex within a tooltip callback, it correctly reflects the index values (0, 1, 2, etc.).

Could someone please confirm if this behavior is a bug or if my expectations are incorrect?

---

<div class="post-metadata">

**Author:** ![seain](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/seain/32/4511_2.png) [@seain](https://forum.servoy.com/u/seain)\
**Post date:** [March 14, 2025, 4:54am UTC](https://forum.servoy.com/t/chartjs-onclick-parameters/23892/2 "2025-03-14T04:54:25Z")

</div>

I confirmed the same behaviour in 2024.12.

I believe it is a bug, if you look at their code that handles the `onClick` event, they use `selected._index` instead of `selected.index` when passing to the API method. You should submit a bug report.

> <https://github.com/Servoy/svyChartJS/blob/master/svychartjs/projects/svychartjs/src/chart/chart.ts#L372>

---

<div class="post-metadata">

**Author:** ![bodnarescu.diana](https://avatars.discourse-cdn.com/v4/letter/b/87869e/32.png) [@bodnarescu.diana](https://forum.servoy.com/u/bodnarescu.diana)\
**Post date:** [March 14, 2025, 7:25am UTC](https://forum.servoy.com/t/chartjs-onclick-parameters/23892/3 "2025-03-14T07:25:07Z")

</div>

Thank you, Seain, for confirming.
