Mouseover event on a horizontal line


« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by marz on 19th September 2012
Hi support!

Do you have a mouseover event on hline???
Posted by on 19th September 2012
Hi,

Do you mean a regular Line chart? If so you can use the chart.events.mousemove. There's no mouseover event, just the click and mousemove. Though you could emulate the mouseover event.
Posted by on 19th September 2012
Hi,

Thanks.
i think i know what you mean.

BTW,another question.
is there a mouseover event only on labels field?
Posted by on 19th September 2012
Hi,

> BTW,another question.
> is there a mouseover event only on labels field?

No it's just the points that are on the line. With canvas the events only apply to the whole canvas - so to facilitate the pseudo mousemove that RGraph has requires checking the position of the mouse. To provide a mouseover event for the labels would require storing the coords of the text - and more importantly checking them every time the mouse is moved. This checking would slow things down quite a bit.

Thanks.
Posted by on 19th September 2012
i see your point.
you really help me a lot.
appreciate.
Posted by on 1st October 2012
Hi,

Having said this though, now with the rect drawing object, you could modify the RGraph.Text function to add a transparent rect object over the text. You could then use the tooltips option or the click/mousemove events to have something happen when the events fire. This would work for angled text though - only horizontal text where the measurements can be calculated and the transparent rect positioned and sized accordingly.

The performance wouldn't be fantastic - though if you don't have a huge amount of labels it may be acceptable.
Posted by on 1st October 2012
Hi,

Here's a quick demo:

dev.rgraph.net/demos/line10.html

It won't be workin for long as I'll be removing the code soon.
Posted by Doha on 17th October 2012
Here is a trick I did to fix the problem with lamda ftcunions in Prototype's Event.observe & Event.stopObserving (For the sake simplicity, i use a function instead of extending Event);function eventObserve(element, type, handler, capture) {element = $(element);handler = handler.toString();if(!element.EventCacher) element.EventCacher = {};element.EventCacher[handlerKey] = handler; Event.observe(element, type, handler, capture);}function eventStopObserving(element, type, handler, capture) {element = $(element);handlerKey = handler.toString();if(element.EventCacher && element.EventCacher[handlerKey]) handler = element.EventCacher[handlerKey];Event.stopObserving(element, type, handler, capture);delete element.EventCacher[handlerKey];}Tested to work with FF 1.5 and IE 6

Add a reply

 




« Back to message list
RGraph on social media