I am adding tipsy to Mike Bostock’s chloropeth map using this: http://bl.ocks.org/ilyabo/1373263. I added another column to my csv titled “county_name.” The tooltip works fine if I try to retrieve the id using k.id but when I try k.county_name I get undefined.
$('svg path').tipsy({
gravity: 's',
html: true,
title: function () {
var k = this.__data__;
return 'Hi there! My county is ' + k.county_name;
}
});
I am loading the csv data with this and I can get different ids to show up but I have only been able to show one county name at a time by manually setting it. I'm at a loss as to how to match up the id with the county_name.
var county;
d3.csv("unemployment2.csv", function (data) {
dataset = data;
county = data[0].county_name;
console.log(county);
});