I have drawn this shape in d3.js using a line generator - the idea is to make it look like a compass.
Left image: what I have
Right image: what I want (just the middle red/black, not the whole compass).
What I used to make this is:
function drawArrowCompass() { //draw arrow
var dataArrow = [
[35, 50],
[50, 0],
[65, 50],
[50, 100],
[35, 50]
];
var lineGenerator = d3.line();
var pathString = lineGenerator(dataArrow);
var compassArrow = d3.select("#noun_compass");
//draw arrow(s)
compassArrow.append("path")
.attr('d', pathString);
}
With the corresponding HTML:
<div id="compass">
<svg width="100" height="100" id="noun_compass"></svg>
</div>
However, the way I've done it, I can't see a way to add two different colour to the path. Does anyone know how I can draw such a shape in d3.js? Thanks in advance!!

