Position labels using polar coordinates:
const markerAngles = Array(8).fill(0).map((n, i) => i * 360 / 8)
const markerIds = markerAngles.map(a => 'marker-' + a)
const pointAngles = Array(50).fill(0).map((n, i) => i * 360 / 50)
const pointIds = pointAngles.map(a => 'point-' + a)
const initNode = canvas.node(1).add({
size: 80,
color: 'transparent',
svgattrs: { stroke: 'gray' },
labels: { 0: { remove: true } }
})
initNode.labels(markerIds).data(markerAngles).add({
text: a => a,
angle: a => a,
})
initNode.labels(pointIds).data(pointAngles).add({
text: 'o',
angle: a => a,
radius: 0,
color: 'red'
})
canvas.pause(0.5)
for (let k = 1; k < 5; k++) {
canvas.node(1).labels(pointIds)
.data(pointAngles)
.radius(a => Math.cos(k * a * Math.PI / 180) * 60)
canvas.pause(1)
}