javascript - Need an image/shape at the position of mouse -



javascript - Need an image/shape at the position of mouse -

i working on research project , need little help. since novice in js/highcharts, issue may seem basic many. want display circle @ mouse position (i.e. whenever mouse hovers on chart).

and when click mouse (mousedown) want circle stick in position, , thereafter circle not follow mouse position remains stuck in mouseclick position.

i believe circle can made using renderer.circle(). , mouse position can obtained jquery function. need logic incorporate them within highstocks.

any help appreciated. if can provide solution based on demo link(jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/stock/demo/candlestick/) thats amazing.

it's not perfect (a little choppy), next should started:

// setup `chart` object ... var circle = chart.renderer.circle(0, 0, 5).attr({ fill: 'blue', stroke: 'black', 'stroke-width': 1 }).add() .tofront() .hide(); var stuck = false; $(chart.container).mousemove(function(event){ circle.show(); if (stuck) { return; } circle.attr({ x: event.offsetx, y: event.offsety }); }); $(chart.container).click(function(event){ stuck = true; circle.attr({ x: event.offsetx, y: event.offsety }); });

here in action: http://jsfiddle.net/ukh5j/

javascript jquery highcharts highstock

Comments

Popular posts from this blog

javascript - mongodb won't find my schema method in nested container -

Hibernate criteria by a list of natural ids -

ios - Lagging ScrollView with UIWebview inside -