如何使用svg.js添加链接或用标签包装圆圈



我使用svg.js创建圆圈,圆圈内有文本并居中。我能够完成

let draw = SVG('main');
// this is for the text
draw.plain(ele.ticket_id).attr({
x: posX,
y: posY,
fill: '#fff',
'alignment-baseline': 'central',
'text-anchor': 'middle'
})
.font({
size: Number((radius/2) * .5).toFixed(2)
});
// and this creates the circle
circle.animate(500, 'quadIn').attr({
fill: '#f06',
id: element.ticket_id,
class: element.status,
cx: posX,
cy: posY
});

但我不确定如何用标签包裹圆圈或文本,使其可以点击。我在svg.js文档中没有看到任何示例。

好吧,它只是在元素中添加了一个linkTo(此处为url(

最新更新