(This is following up on this question.) Super-brief/basic Q: is there any way that I can concatenate d.(something)
with a numeric value? I'm using a CSV and my variable names follow a pattern (for year 2012 = y2012, year 2002 = y2002, etc).
I'd like to refer to the current year being examined after each keydown. For example:
svg.selectAll("circle")
.transition(1500)
.attr("r", function(d) {
return Math.sqrt(parseInt("d.y"+year) * 0.0004);
})
Console's telling me "d.y"+year
is not kosher. I've tried defining it as a variable, testing it out in the console (where it returns "d.y2012"
), but it still breaks the function (d)
.