I am using d3
in my react application, where I write code using Typescript. I have the following code:
function mousemove() {
// recover coordinate we need
var x0 = xScale.invert(d3.mouse(this)[0]);
var i = bisect(data, x0, 1);
var selectedData = data[i]
focus
.attr("cx", xScale(selectedData.dateCreated))
.attr("cy", yScale(selectedData[value]))
focusText
.html("x:" + selectedData.x + " - " + "y:" + selectedData.y)
.attr("x", xScale(selectedData.dateCreated) + 15)
.attr("y", yScale(selectedData[value]))
}
d3.mouse(this)[0]
throws the following error:
'this' implicitly has type 'any' because it does not have a type annotation.
Any suggestions to resolve it? This error is common typescript but I do not how to resolve it with d3.mouse
function.