Please see HTML Canvas - Script solution hopefully this will help. I have also looked around the internet to find a solution, but didn't have much look in finding a solution.
To use this code copy and paste into <body></body> of HTML file.
<script>
function Arrow(x1, y1, x2, y2, Arrow_Type, Hex_Color, L_Width, Element_ID) {
var c = document.getElementByID(Element_ID);
var ctx = c.getContext("2d");
var A_start = 10;
var O_start = 3.75;
var H_start = Math.sqrt(Math.pow(A_Start, 2) + Math.pow(O_start, 2));
var change_arrow_radians = Math.atan2(O_start, A_start);
var change_x_main = Math.abs(x1 - x2);
var change_y_main = Math.abs(y1 - y2);
var change_angle_radians = Math.atan2(change_y_main, change_x_main);
var change_angle_degrees = change_angle_radians * ( 180 / Math.PI);
var change_x_0_arrowhead = Math.cos(change_angle_radians + change_arrow_radians) * H_start;
var change_y_0_arrowhead = Math.sin(change_angle_radians + change_arrow_radians) * H_start;
var change_x_1_arrowhead = Math.cos(change_angle_radians - change_arrow_radians) * H_start;
var change_y_1_arrowhead = Math.sin(change_angle_radians - change_arrow_radians) * H_start;
ctx.beginPath();
ctx.lineWidth = L_Width;
ctx.strokeStyle = Hex_Color;
if (Arrow_Type == true) {
if (((x1 < x2) && (y1 > y2)) || ((x1 == x2) && (y1 > y2))) {
ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2);
ctx.moveTo(x1 + change_x_0_arrowhead, y1 - change_y_0_arrowhead);
ctx.lineTo(x1, y1);
ctx.lineTo(x1 + change_x_1_arrowhead, y1 - change_y_1_arrowhead);
} else if ((x1 > x2) && (y1 > y2)) {
ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2);
ctx.moveTo(x1 - change_x_0_arrowhead, y1 - change_y_0_arrowhead);
ctx.lineTo(x1, y1);
ctx.lineTo(x1 - change_x_1_arrowhead, y1 - change_y_1_arrowhead);
} else if (((x1 < x2) && (y1 < y2)) || ((x1 < x2) && (y1 == y2))) {
ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2);
ctx.moveTo(x1 + change_x_0_arrowhead, y1 + change_y_0_arrowhead);
ctx.lineTo(x1, y1);
ctx.lineTo(x1 + change_x_1_arrowhead, y1 + change_y_1_arrowhead);
} else if (((x1 > x2) && (y1 < y2)) || ((x1 > x2) && (y1 == y2)) || ((x1 == x2) && (y1 < y2))) {
ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2);
ctx.moveTo(x1 - change_x_0_arrowhead, y1 + change_y_0_arrowhead);
ctx.lineTo(x1, y1);
ctx.lineTo(x1 - change_x_1_arrowhead, y1 + change_y_1_arrowhead);
}
} else {
if (((x1 < x2) && (y1 > y2)) || ((x1 < x2) && (y1 == y2)) || ((x1 == x2) && (y1 > y2))) {
ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2);
ctx.moveTo(x2 - change_x_0_arrowhead, y2 + change_y_0_arrowhead);
ctx.lineTo(x2, y2);
ctx.lineTo(x2 - change_x_1_arrowhead, y2 + change_y_1_arrowhead);
} else if (((x1 > x2) && (y1 > y2)) || ((x1 > x2) && (y1 == y2))
ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2);
ctx.moveTo(x2 + change_x_0_arrowhead, y2 + change_y_0_arrowhead);
ctx.lineTo(x2, y2);
ctx.lineTo(x2 + change_x_1_arrowhead, y2 + change_y_1_arrowhead);
} else if ((x1 < x2) && (y1 < y2)) {
ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2);
ctx.moveTo(x2 - change_x_0_arrowhead, y2 - change_y_0_arrowhead);
ctx.lineTo(x2, y2);
ctx.lineTo(x2 - change_x_1_arrowhead, y2 - change_y_1_arrowhead);
} else if (((x1 > x2) && (y1 < y2)) || ((x1 == x2) && (y1 < y2))) {
ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2);
ctx.moveTo(x2 + change_x_0_arrowhead, y2 - change_y_0_arrowhead);
ctx.lineTo(x2, y2);
ctx.lineTo(x2 + change_x_1_arrowhead, y2 - change_y_1_arrowhead);
}
}
ctx.stroke();
}
</script>
Hopefully this is easy enough to understand, it might be a long winded way of doing it but I find this easier to understand.
To use the above function copy the following into HTML file
<head>
<meta charset="utf-8" http-equiv="X-UA-Compatible" content="IE=9" />
<title></title></head>
<body>
<canvas id="FIG1" width="1000" height="1000" style="border-style:none; border-width:thin">
This text is displayed if your browser does not support HTML5 Canvas.</canvas>
<script>
Arrow(250, 400, 250, 0, true, "#000000", 1, "FIG1");
Arrow(250, 600, 250, 1000, true, "#000000", 1, "FIG1");
Arrow(240, 500, 0, 500, true, "#000000", 1, "FIG1");
Arrow(260, 500, 490, 500, true, "#000000", 1, "FIG1");
Arrow(240, 400, 0, 0, true, "#000000", 1, "FIG1");
Arrow(240, 600, 0, 1000, true, "#000000", 1, "FIG1");
Arrow(260, 400, 490, 0, true, "#000000", 1, "FIG1");
Arrow(260, 600, 490, 1000, true, "#000000", 1, "FIG1");
Arrow(750, 400, 750, 0, false, "#000000", 1, "FIG1");
Arrow(750, 600, 750, 1000, false, "#000000", 1, "FIG1");
Arrow(740, 500, 510, 500, false, "#000000", 1, "FIG1");
Arrow(760, 500, 1000, 500, false, "#000000", 1, "FIG1");
Arrow(740, 400, 510, 0, false, "#000000", 1, "FIG1");
Arrow(740, 600, 510, 1000, false, "#000000", 1, "FIG1");
Arrow(760, 400, 1000, 0, false, "#000000", 1, "FIG1");
Arrow(760, 600, 1000, 1000, false, "#000000", 1, "FIG1");
</script>
</body>
I would appreciate any comments on the above code
Thank You