How do I get the xaxisLabels value when clicking on it?Posted by Santhosh at 15:02 on Saturday 9th January 2021 [link]
HiPosted by Richard at 16:31 on Saturday 9th January 2021 [link]
I am using RGraph in my angular 7 application. all working as expected. But i need a feature as below.
I want to get the value of xaxislabel on clicking on it. Please let me know if anyone has answer.
Thanks in advance
I have tried below but not working:
Posted by Santhosh at 17:21 on Saturday 9th January 2021 [link]
You were close - I've made a demo with a few alterations:
<canvas id="cvs1" width="600" height="250">[No canvas support]</canvas>
label = document.getElementsByClassName('rgraph_accessible_text_xaxis_labels');
// Add a mousemove listener that changes the mouse cursor to the hand
e.target.style.cursor = 'pointer';
// Add a click listener that shows an alert
alert('Text: '+ label.innerHTML);
There's a codepen here that demonstrates it (only the first label is clickable - but it's easy to change that to all of the labels):
Your answers are always helpfull.
[Replies are now closed]