Most of D3’s native selection APIs also return the selection (or a new selection), to enable multiple method calls to be chained together. Since the code you write isn’t on the selection prototype, chaining your methods would take some extra work. selection.call()
will call any function reference you give it, providing the selection as the first parameter, and then it returns the selection for you to ensure chaining is supported.
Interesting transcript. I missed the parts about Juanita in the video. Anyway, when you mouseover the text itself, the mouseover for the rect is lost. Is there a clean way to handle that so that the rect still expands when the mouse is over the text?
LOL, good catch on the transcript, I've reported that to the Eggheads in charge.
Also a good catch on the code. If you add .style('pointer-events', 'none')
to the part that creates the text
elements that will fix that issue.