I need to display an arrow to show the evolution of some metric, for this I created an algorithm that draws the line and add use a marker to have the shape of an arrow.
I've tried to change the refX so the marker would finish at the end but since the line is thick it displays the rest of the line after the marker. I can reduce change this refX in a way that I don't see the rest of the line but I want to see the whole marker within the limits of the svg.
I could also reduce the length of the line so the line + the marker takes the whole place but then I cannot find the correct amount of pixels I need to remove.
The line is rendered dynamically which means it won't always be in that way. In a svg(x,y) from (0,0) to (100,100) it can go from (100,0) to (100,100).
Current code displays the arrow overflowing the svg, I would like to have everything in it.
<svg class="svg" style="height: 190px; width: 328px; border:1px solid blue;">
<marker class="red_arrow_normal" markerUnits="strokeWidth" viewBox="0 0 10 10" refY="6" orient="auto"
markerHeight="10" markerWidth="10" id="red-3" refX="10">
<path d="M2,2 L10,6 L2,10 L6,6 L2,2" style="fill: red;"></path>
</marker>
<line x1="0" y1="0" x2="328" y2="190" stroke="red" stroke-width="10" marker-end="url(#red-3)"></line>
</svg>
refX="9"However since your line has the same size as the svg canvas diagonal the tip of the arrow will fall slightly outside the svg canvas. Y suppose you need a bigger canvas or to dosvg{overflow:visible;}- enxaneta