score:0

May be you can have a variable

  var selected = "ano2009";//set it to default value

Now when ever the year is changed change the selected variable.

Like this:

d3.select("#vacant")
    .on("click", function() {
        selected = "vacant";
        //Update scale domain

Like this:

   d3.select("#totalUnits")
        .on("click", function() {
           selected = "totalUnits";

... so on

Now in the tip function you can do:

var tip = d3.tip()
                                                  .attr('class', 'd3-tip')
                                                  .offset([-10, 0])
                                                  .html(function(d) {

 //note d[selected] will select the clicked year data.                                                  
  return "No: <strong>" + d.propertyName + "</strong> foram registrados <strong>" + d[selected] + "</strong>";
                                                  })

working code here


Related Query

More Query from same tag