When I try to drag an element I get the error:
'Uncaught Error: unknown type: dragstart'
What does it mean?
const drag = d3
.drag()
.on('dragstart', dragstarted)
.on('drag', dragged)
.on('dragend', dragended)```
container
.append('g')
.attr('class', 'dot')
.selectAll('circle')
.append('circle')
.attr('r', 5)
.attr('cx', 30)
.attr('cy', 30)
.call(drag)```
Drag events of d3-drag are start
, drag
, end
. So if you change your code,
const drag = d3
.drag()
.on('start', dragstarted)
.on('drag', dragged)
.on('end', dragended)
your problem will be resolved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With