在备选点中为PolyLine创建SVG标记。 (步骤曲线)

时间:2013-10-18 09:51:21

标签: javascript svg markers polyline

我正在创建折线作为阶梯曲线。我希望标记放在重要点上,而不是放在台阶线的每一端。我该如何做到这一点?       

            <polyline points="0,0 140,125 160,140 180,220 220,240 300,280 400,450    500,500 900,900"
                      style="fill: none;" 
                      stroke="blue"
                      stroke-width="5" 
                      marker-start="url(#point)" 
                      marker-mid="url(#point)" 
                      marker-end="url(#point)"
                      clip-path="url(#clip)" />
            <defs>
                <marker id="point" viewbox="0 0 10 10" refx="5" refy="5" markerwidth="10" markerheight="10"
                    orient="auto" markerUnits = "userSpaceOnUse">
                    <circle cx="5" cy="5" r="1" stroke="red" stroke-width="1" fill="black">
                    </circle>
                </marker>
            </defs>
        </g>

我不想使用两种不同的SVG PolyLine来创建正确的标记。

1 个答案:

答案 0 :(得分:1)

除了marker-startmarker-midmarker-end提供的粗略控制之外,无法控制线条中的哪个点获得标记。

为SVG2提出了更好的控制,但现在对你没有帮助。

您唯一的解决方案是为每个感兴趣的点为文件添加单独的元素。