anvaka / VivaGraphJS

Graph drawing library for JavaScript
Other
3.76k stars 425 forks source link

Tooltip again #139

Closed ArnauC closed 9 years ago

ArnauC commented 9 years ago

Sorry for reopen this issue..

My problem is not about listening the events, is rather about displaying the tooltip. Since the nodes do not seem to be DOM objects, I don't know how to display labels or tooltips on them...

Any idea? Thank you!

ArnauC commented 9 years ago

Ok, I did it..

Just in case anyone is also interested I explain a bit what I did:

Since nodes rendered by VivaGraph are not DOM objects (at least they do not appear to me as so), is not that easy to display tooltips, because all the tooltip libraries including jQuery think of tooltips as a label appearing over some TEXT or LINK or IMAGE, but always, a DOM object.

I needed to trigger the tooltip from an event listener and there are not many libraries or documentation about how to do that.

A easy one is overlib: https://github.com/overlib/overlib/blob/master/overlib.js

And here is some basic documentation about how to display tooltip with it. Is in spanish, but you can find the js code.

http://librosweb.es/libro/javascript/capitulo_8/tooltip.html