3
d3を使用して、サークルエレメントの隣にラベルが表示されています。 ラベルの隣にラベルが付いた円をドラッグできるはずです。D3ドラッグ可能なサークルにラベルを付ける
アドバイスありがとうございます。 https://jsfiddle.net/o3yg8sq1/2/
const svg = d3.select('svg'),
width = +svg.attr('width'),
height = +svg.attr('height');
const node = svg.append('g')
.attr('class', 'nodes')
.selectAll('circle')
.data([{1:1},{2:2}])
.enter().append('circle')
.attr('r', 15)
.attr('cx', function (d, i) { return Math.random() * 100; })
.attr('cy', function (d, i) { return Math.random() * 100; })
.call(d3.drag()
.on('drag', dragmove));
svg.selectAll('.nodes')
.append('text')
.text(function(d){return 'test';})
function dragmove(d) {
d3.select(this).attr('cx', d3.event.x);
d3.select(this).attr('cy', d3.event.y);
}