문제

GraphDracula is a nice simple small graph visualization library based on RaphaelJS. However two very important things I would want it to detect are onmouseover (over a node) and onclick (over a node again).

e.g. In their most basic example, a mouseover on "cherry" node should give some extra details about cherry. Clicking it shall pop an alert box.

How can I do that ?

도움이 되었습니까?

해결책

You can do it by iterating through the nodes in the graph object and adding Raphael handlers on the shape object: http://jsfiddle.net/imsky/65Mpy/

var g = new Graph();
//Rest of code
for(var i in g.nodelist){
   g.nodelist[i].shape.mouseover(console.log)
   g.nodelist[i].shape.click(console.log)
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top