There are a few ways that you could fix this. One useful technique is
closures. In this case, you create a new listener that is bound to the
value 3:
function textmouseover(value) {
return function() {
console.log(value + " We are here.");
};
}
A more idiomatic way of doing this with D3 is to use data binding.
Like most other functions in D3, your event listener is called with
two arguments: the current data (d) and index (i). The `this` context
of the callback function is the associated DOM element. For example:
vis.append("svg:text")
.data([3])
.on("mouseover", textmouseover);
function textmouseover(d) {
console.log(d + " We are here.");
}
More details:
https://github.com/mbostock/d3/wiki/Selections#wiki-on
Mike