我正在研究d3.js中的一個簡單演示 - mouseover應增加圓圈的大小並顯示文本「Hello」,mouseout執行對面。無法更改d3.js中的文本attr(「y」)使用函數
這裏的codepen鏈接 - http://cdpn.io/LzIjt
當我嘗試文本的「Y」值鏈接到圓的「CY」值,文本不顯示。然而,它工作正常,「×」
成功 - 文本顯示 -
vis.append("svg:text")
.attr("x",function()
{
return (d3.select("circle").attr("cx") - 17);
})
.attr("y",103)
.text("Hello")
.attr("visibility","hidden");
失敗 - 文本不顯示 -
vis.append("svg:text")
.attr("x",function()
{
return (d3.select("circle").attr("cx") - 17);
})
.attr("y",function()
{
return (d3.select("circle").attr("cy") + 3);
})
.text("Hello")
.attr("visibility","hidden");
我思念的東西與屬性的工作方式?
謝謝!
〜Madhu
謝謝!修復它......! – Madhu 2013-02-22 20:48:44