Reputation: 9
i am creating marker on my force directed graph. in my force directed graph i have lines or links of different thickness or stroke. because of this the markers are getting created with different sizes. what i want is to have uniform size of marker. here is my code for marker :
`svg.append('defs').append('svg:marker')
.classed("arrowhead",true)
.attr('id', 'arrowhead')
.attr('viewBox', '0 -5 40 40')
.attr('refX', "25")
.attr('markerWidth', 8)
.attr('markerHeight', 8)
.attr('orient', 'auto')
.append('svg:path')
.attr('d', 'M0,-5L10,0L0,5')
.attr('fill', 'black');`
how can i have marker with uniform size?? thanks in advance..
Upvotes: 0
Views: 1205
Reputation: 60986
By default markers are relative to the stroke-width (see spec), but you can set markerUnits="userSpaceOnUse"
on the marker element to make the marker size not be relative to the stroke-width.
To clarify, this doesn't make the marker size static and the same for all elements using the marker. The rendered marker is still subject to the transform set on the elements that use the marker. But it does make the size be independent of the stroke-width.
Upvotes: 1