jquery - How to get the mouse's position in jqPlot -


i write code gives coordinates of place user clicks mouse on jqplot graph. using option

cursor: { show: true, tooltiplocation:'sw', }

i can see location of mouse on graph on screen. however, cannot use it. know how it?

writing:

$('#chartdiv').bind('jqplotclick',function (event) {

 alert( 'the mouse cursor @ ('+event.pagex+','+event.pagey+').');         }  

);

gives me coordinates of mouse on whole screen, , if knew how coordinates of top left point of axes of graph, have solved problem. don't manage it. possible in jqplot?

thank help, , best wishes, daphne

i think can find using :

event.originalevent.layerx  event.originalevent.layery 

according testing : event.pagex , event.pagey gives coordinates according div including graphic (i.e. graphic + title + offset...). event.screenx , event.screeny gives coordinates according full screen. event.originalevent.layerx , event.originalevent.layery gives coordinates according graphic div.

see working example here


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -