I created a marker in javascript, It looks like below:
var marker = document.createElementNS(SVG.ns, "marker"); marker.setAttribute("markerWidth", "3"); marker.setAttribute("markerHeight", "3"); marker.setAttribute("id", "mkrCircle"); marker.setAttribute("viewBox", "0 0 12 12"); marker.setAttribute("orient", "auto"); marker.setAttribute("stroke", "#000000"); marker.setAttribute("stroke-width", "2"); marker.setAttribute("fill", "#ffffff"); marker.setAttribute("refX", "12"); marker.setAttribute("refY", "6"); var mkrContent = document.createElementNS(SVG.ns, "circle"); mkrContent.setAttribute("r", "5"); mkrContent.setAttribute("cx", "6"); mkrContent.setAttribute("cy", "6"); marker.appendChild(mkrContent); defs.appendChild(marker); // <-- defs is svg defs element
And I used it for a path:
<path marker-mid="url(#mkrCircle)" d="M0,0L100,100" stroke-width="3"></path>
But it does not appear in the path at all, Why?
Thanks in advance