I'm facing 3 errors with Typescript in angular when working with D3js elements. I tried to create a mouseover event to display tag and value data corresponding to the bar graph, but encountered issues. I attempted declaring strings and even added "noImplicitAny: false" to the tsconfig.js file. I'm currently troubleshooting to identify the problem area. See below for the code snippet:
// object.enteries: creates arrays of an element
svg.selectAll("bars")
.data(sortedata)
.enter()
.append("rect")
.attr('x', function(d):any {return xAxis(d[0])})
.attr('y', function(d){return yAxis(Number(d[1]))} )
.attr('width', xAxis.bandwidth())
.attr("height", (d) => this.height - yAxis(Number(d[1])))
.attr("fill", "#d04a35")
.on('mouseover', mouseover)
const tip = d3.select(".tooltip")
function mouseover(event,d){
tip
style('left', `${event.clientX + 15}px`)
style('top' , `${event.clientX + 15}px`)
style('opacity', 0.88)
tip.select("h3").html("tag:" +d[0]),
tip.select("h4").html("value:" +d[1]);
}
You can also view the errors visually here.