我使用以下SVG代码构建了一个水平条形图表,它很好,但我还需要在图表之前和之后添加两个内联标签。我知道如何使用HTML和CSS添加它们,但我只想使用纯SVG来解决这个问题。如何实现?
这是我现在拥有的内容:
这是我想要的内容:
<svg class="chart" width="300px" height="40">
<g transform="translate(0,0)">
<rect width="82%" height="22" fill="lightskyblue"></rect>
<rect width="100%" height="22" style="fill:none; stroke-width:1; stroke:gray;"></rect>
<text y="30" dx="0.25em" dy=".35em">0</text>
<text x="20%" y="10" dy=".35em" fill="red">|</text>
<text x="20%" y="30" dx="-0.25em" dy=".35em" fill="red">13</text>
<text x="100%" y="30" dx="-1.25em" dy=".35em">63</text>
</g>
</svg>