Closed gka closed 12 years ago
Three new use scenarios:
If no data is specified at all, the raw shape data will be passed to all callback functions.
data
var stats = { "AL": 8.9, "CA": 9.6, ... }; map.choropleth({ colors: function(d) { return colorscale.getColor(stats[d.code]) }; });
You can simplify your callbacks by setting a data callback function which processes the raw shape data before it will be passed to other callback functions. The raw shape data will be optionally passed as second argument.
map.choropleth({ data: function(d) { return stats[d.code] }, colors: function(value) { return colorscale.getColor(value) } })
However, the old-school way of data injection will work, too.
map.choropleth({ data: stats, colors: function(value) { return colorscale.getColor(value) } })
fixed in 9752ac61d5
Three new use scenarios:
No data injection
If no
data
is specified at all, the raw shape data will be passed to all callback functions.Data injection through callback function
You can simplify your callbacks by setting a data callback function which processes the raw shape data before it will be passed to other callback functions. The raw shape data will be optionally passed as second argument.
Old-school data injection
However, the old-school way of data injection will work, too.