svg - Can't dynamically place text over the top of polygon -


i want put text on top of polygons. unfortunately text goes behind shape there similar css z index?

here part of svg in html (its lot of code because im drawing map here little part of it.) although below have same coords, did place them on shape using inspector in chrome, shapes remained above text.

<svg width="400" height="800" viewbox="0 0 400 800" id="svg-doc">  <rect id="central-park" class="shape" x="154" y="370"width="53" height="127" />     <a xlink:href="/zipcodes/16">       <rect id="z10024" class="shape" x="68" y="415" width="85" height="40" />       <text x="0" y="15" fill="#5df8b8">10024</text>     </a>     <a xlink:href="/zipcodes/17">       <rect id="z10023" class="shape" x="68" y="457" width="85" height="40"  />       <text x="0" y="15" fill="#5df8b8">10024</text>     </a>     <a xlink:href="/zipcodes/10">       <polygon id="z10034" class="shape" points="189,156 137,122 106,121 101,129 99,155 79,155 78,105 94,79 121,67 128,82 163,61 177,62 191,80" />       <text x="0" y="15" fill="#5df8b8">10024</text>     </a>     <a xlink:href="/zipcodes/28">         <polygon id="z10040" class="shape" points="188,167 186,155 137,122 108,122 102,126 100,153 77,156 77,166" />         <text x="0" y="15" fill="#5df8b8">10024</text>     </a>     <a xlink:href="/zipcodes/29">       <polygon id="z10033" class="shape" points="189,166 187,197 187,203 81,203 77,194 78,166" />        <text x="0" y="15" fill="#5df8b8">10024</text>     </a> 

according site: http://alignedleft.com/tutorials/d3/an-svg-primer/

the order in elements coded determines depth order.

in fact, problem seems of text in same place, @ (0,15) - not underneath polygons @ all?

i edited code question move text on polygons, displayed correctly...

<svg width="400" height="800" viewbox="0 0 400 800" id="svg-doc">  <rect id="central-park" class="shape" x="154" y="370"width="53" height="127" />     <a xlink:href="/zipcodes/16">       <rect id="z10024" class="shape" x="68" y="415" width="85" height="40" />       <text x="70" y="450" fill="#5df8b8">10024</text>     </a>       <a xlink:href="/zipcodes/17">       <rect id="z10023" class="shape" x="68" y="457" width="85" height="40"  />       <text x="70" y="480" fill="#5df8b8">10023</text>     </a>       <a xlink:href="/zipcodes/10">       <polygon id="z10034" class="shape" points="189,156 137,122 106,121 101,129 99,155 79,155 78,105 94,79 121,67 128,82 163,61 177,62 191,80" />       <text x="90" y="110" fill="#5df8b8">10034</text>     </a>       <a xlink:href="/zipcodes/28">         <polygon id="z10040" class="shape" points="188,167 186,155 137,122 108,122 102,126 100,153 77,156 77,166" />         <text x="120" y="160" fill="#5df8b8">10040</text>     </a>       <a xlink:href="/zipcodes/29">       <polygon id="z10033" class="shape" points="189,166 187,197 187,203 81,203 77,194 78,166" />        <text x="120" y="190" fill="#5df8b8">10033</text>     </a> </svg> 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -