Is there any way to handle click event for any mouse position? I found only support for clicks on data points.
I would like to create mouse click handler for any cursor position and also I want to get the value of X axe corresponding to that position.
If not supported out of the box, where should I start looking in order to make such extension?
I’m considering some ugly approach – find the native Canvas element, add mouse handler there, calculate X value for this coordinate (I know max X value and canvas size), but this probably won’t be accurate cause axisY title takes some place on chart … and in general this sounds like a dirty hack.
This will not be possible directly via the existing API. But if you are ok editing CanvasJS code, Axis has a function getXValueAt(x) which can convert given pixel value to X value on axisX. You can make it public by writing few lines of code inside CanvasJS object which is present at the end of file.