Closed gunthercox closed 10 years ago
I just realized my mistake. I wasn't setting the key correctly so it was setting the actual value key
which of course doesn't exist on the map. Bellow is the code that I should have been using. Basically the right way to do this is to pass the variable into the dictionary as a key with a value being set.
for (key in map.options.data) {
var data = {};
data[key] = "green";
map.updateChoropleth(data);
}
There seems to be an issue updating choropleths using string values. I've included an example document which I will convert into a jsFiddle later (currently unavailable).
Basically the issue that i'm running into is that I can update the map with something like
map.updateChoropleth({"NY": "green"})
, however if I assign"NY"
to a variable first, the map wont be updated. So the failure to update happens with something like:I'm wondering if this issue has something to do with the checks that are being made in https://github.com/markmarkoh/datamaps/blob/master/src/js/datamaps.js#L573 to determine what type of value was passed in.