我正在使用 d3.svg.arc() 绘制一段圆,将内半径和外半径设置为相同并具有一些随机的扫角。现在我想在它的两端都有箭头。marker-start 属性工作正常。但问题在于标记端。当我运行代码时,我会在开始时获得两个标记。请帮帮我。
<svg version="1.1">
<defs>
<marker id="endtriangle"
viewBox="0 0 10 10" refX="0" refY="5"
markerUnits="strokeWidth"
markerWidth="4" markerHeight="3"
orient="auto">
<path d="M 0 0 L 10 5 L 0 10 z" />
</marker>
<marker id="starttriangle"
viewBox="0 0 10 10" refX="5" refY="5"
markerUnits="strokeWidth"
markerWidth="4" markerHeight="3"
orient="auto">
<path d="M -2 5 L 8 0 L 8 10 z" />
</marker>
</defs>
</svg>
<script type="text/javascript">
var arc=d3.svg.arc()
.innerRadius(140)
.outerRadius(140)
.startAngle(0)
.endAngle(Math.PI/3)
d3.select("svg").append("path")
.attr("d",arc)
.attr("transform","translate(200,200)")
.attr("stroke","black")
.attr("marker-end","url(#endtriangle)")
.attr("marker-start","url(#starttriangle)")
.attr("fill","none")
.attr("stroke-width","10")
.attr("id","dimen")
</script>
</body>