admin管理员组文章数量:1289879
I am not sure why my click method is not working. In this test I want to be able to click on one of the circle nodes on the graph and display its number. Hovering over works kind of.
What library's click event am I using, D3? Jquery? normal JS?
ultimately I want to do tooltips when I hover over the nodes, and make them go away when I move the mouse away
/
dots.enter()
.append("circle")
//.append("svg:circle")
.attr("class", "dot")
.attr("cx", plete_line.x())
.attr("cy", plete_line.y())
.attr("r",3.5)
.append("title")
.text(function(d){ return dpleted;})
.on("click", function(d) { alert("hello"); });
I am not sure why my click method is not working. In this test I want to be able to click on one of the circle nodes on the graph and display its number. Hovering over works kind of.
What library's click event am I using, D3? Jquery? normal JS?
ultimately I want to do tooltips when I hover over the nodes, and make them go away when I move the mouse away
http://jsfiddle/ericps/b5v4R/
dots.enter()
.append("circle")
//.append("svg:circle")
.attr("class", "dot")
.attr("cx", plete_line.x())
.attr("cy", plete_line.y())
.attr("r",3.5)
.append("title")
.text(function(d){ return d.pleted;})
.on("click", function(d) { alert("hello"); });
Share
Improve this question
asked Jan 15, 2013 at 21:58
CQMCQM
44.3k77 gold badges229 silver badges370 bronze badges
1 Answer
Reset to default 6You've attached the event handler to svg:text element. I think you want to attach it to the svg:circle element:
dots.enter().append("circle")
.attr("class", "dot")
.attr("cx", plete_line.x())
.attr("cy", plete_line.y())
.attr("r",3.5)
.on("click", function(d) { alert("hello"); })
.append("title")
.text(function(d){ return d.pleted; });
本文标签: javascriptD3 and mouse eventsclick test not workingStack Overflow
版权声明:本文标题:javascript - D3 and mouse events, click test not working - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741466332a2380334.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论