I'm using d3 v4 and trying to apply a style to an element on mouseover. I'm wondering if it's an API change with V4 but I can't seem to get at the node
I have code:
.on('mouseover', () => {
let self = d3.select(this);
let c = self.attr('class');
but this gives an error
Cannot read property 'getAttribute' of null
So the d3.select()
doesn't seem to work...
The mouseover IS firing however.
I can use
.on('mouseover', (elem) => {
console.log('elem', elem);
Which will give me some type of D3 object, but not a DOM node. I can't use any D3 methods on this object
elem.classed("hilite", true);
elem.attr("class", "hilite");
Neither of those methods exist on a d3 returned object.
So how do I do this super basic operation in d3?
related to Change class of one element when hover over another element d3