This refers to my previous question: How to draw line automatically by reading coordinates from file?
I need to add an arrow head at one side, based on one column flag
(R
for right, L
for left):
x1,y1,x2,y2,Flag
1,2,3,2,L
3,3,5,3,R
5,3,6,3,L
7,5,7,5,R
8,6,8,6,L
9,7,2,7,L
How is it possible?
The most obvious solution here would be setting the marker as
marker-end
ormarker-start
according to the value of theflag
property.However, on a second thought, we can do something more interesting here: we can set all markers as
marker-end
and, according to theflag
, we swap thex1
andx2
properties, making:x1
smaller thanx2
if flag isR
;x1
bigger thanx2
if flag isL
;It can be done with:
Here is the demo:
Since your values are too small I'm multiplying them here, so we can better see the lines. Also, because you didn't share any marker, I'm using the one at MDN.