【发布时间】:2015-10-22 10:45:36
【问题描述】:
我需要制作一个模板,通过查找特殊标签并替换这些值来为下面的坐标插入新值。
我给出了一个 SVG,下面是我需要更改的一个小 sn-p,以便我可以模板/添加占位符,因为下面的值将是动态的。
<g id="Layer_1">
<g id="shape1">
<polygon class="poly1" points="6.7,105.4 -19.2,190.5 -20.4,123.5 1.6,143.6 "/>
</g>
<polygon id="shape2" class="poly1" points="-20.9,300.3 -37.7,103.3 -10.9,204.3 -0.1,233.6"/>
<circle id="circleSolid" class="poly2" cx="6.7" cy="306.1" r="10.3"/>
<g id="circleDashed">
<circle class="poly3" cx="2.6" cy="304.7" r="10.3"/>
</g>
<text transform="matrix(1 0 0 1 -40.7301 191.3002)" class="poly1 poly3 poly4">Poly1</text>
<text transform="matrix(1 0 0 1 -40.7302 200.3002)" class="poly1 poly3 poly4">Poly2</text>
</g>
<g id="Layer_7">
<line id="newShape1" class="poly5" x1="-30.7" y1="170.7" x2="12.2" y2="171.7"/>
<line id="newShape2" class="poly5" x1="-11.5" y1="160.7" x2="0.1" y2="200.3"/>
</g>>
我想知道我不能只在下面的 html 标记中添加[x1] 标记以进行模板化。我应该只使用类来插入新的动态值吗?我应该如何模板化 SVG 绘图?
我将在 C# 中动态插入新值。
【问题讨论】: