Why svg: text just isn't showing up?

I need to skip something obvious, but I cannot show <text> . See http://jsfiddle.net/ydaLh/ for HTML + CSS

 <svg style="width: 320px; height: 200px; top: 0px; left: 0px; position: relative;"> <g class="depth"> <g class="children"> <rect class="child" x="99" y="0" width="47" height="30"> <text dy=".75em" x="105" y="6">PRIMARY</text> </rect> <rect class="child" x="90" y="0" width="8" height="30"> <text dy=".75em" x="96" y="6">MASTER</text> </rect> <rect class="parent" x="90" y="0" width="56" height="30"></rect> </g> </g> </svg> 

Based on http://bost.ocks.org/mike/treemap/

+6
source share
1 answer

In SVG, you do not insert text elements into graphic elements, you should have something similar to:

 svg .append("rect") .append("text"); 

But you really need to:

 svg.append("rect"); svg.append("text"); 
+10
source

All Articles