-1

I am trying to label Y-axis of my graph using following code:

 svg1.append("text").attr("class", "y label")
.attr("text-anchor", "end")
.attr("y", 10)
.attr("dy", "-40")
.attr("transform", "rotate(-90)")
.text("life expectancy (years)");

But when I try to change the 'y' value to 50, the label moves towards right, I am not able to understand why it is so. Moreover what is "dy" for, and why there is no "x" attribute. :(

Please help.

4

1 に答える 1

1

デフォルトの座標軸を変換します。dy は dynamic-y を意味し、x と dx を使用できると思います。

http://www.w3.org/TR/SVG11/text.html#TSanElementDXAttribute

于 2012-10-07T14:16:14.797 に答える