Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import constant from "./constant.js";
import ArrowOnPath from "./arrowonpath.js";
function getRandomColorRgb() {
let red = Math.floor(Math.random() * 256);
let green = Math.floor(Math.random() * 256);
let blue = Math.floor(Math.random() * 256);
return `rgb(${red}, ${green}, ${blue})`;
}
export default function () {
console.log('ssksk');
var arrowParts = constant(3),
arrowThickness = constant(5),
arrowAngle = constant(2),
arrowPadding = constant(1),
output = null,
circularSvg = d3.select("svg"), // Move out of here it doesnt belong
circularPath = circularSvg.select("path").node();
console.log('ezteze');
function cyclicarrow(data) {
console.log('blah');
var l = circularPath.getTotalLength();
var segs = 8;
var seg_l = l / segs;
console.log(l, seg_l)
for (var i = 0; i < segs; i++) {
var start = i * seg_l;
var end = (i + 1) * seg_l;
console.log(i, start, start);
var ar = new ArrowOnPath(circularPath, start, end);
circularSvg.append("path")
.attr("d", ar.toString())
.attr("style", "fill:" + getRandomColorRgb());
}
}
cyclicarrow.arrowAngle = function (_) {
return arguments.length ? (arrowAngle = typeof _ === "function" ? _ : constant(+_), cyclicarrow) : arrowAngle;
};
return cyclicarrow;
}