Skip to content Skip to sidebar Skip to footer

Closure Issue Using D3 Tip

Yet another javascript beginner with a closure issue... However, I have been reading up on various sources on closure binding (most helpful), but I still can't fully transfer this

Solution 1:

If you don't declare your variable using var, it becomes a global.

So, this is the simple fix, inside both functions:

var tip = d3.tip()
    .attr("class", "d3-tip")
    .direction("s")
    .html(tipRenderer);

Here is your updated fiddle: https://jsfiddle.net/wd08acg1/


Post a Comment for "Closure Issue Using D3 Tip"