Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix problem with "Uncaught Error: unknown type: dragstart"

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)```
like image 409
Danil Avatar asked Apr 19 '19 07:04

Danil


1 Answers

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.

like image 183
sdkcy Avatar answered Oct 22 '22 03:10

sdkcy