carto = Cartogram()
.width(width)
.height(height)
.topoJson(shape)
.topoObjectName('states')
.projection(projection)
.iterations(20)
.value(function(d) {
return d.properties.value;
})
.color(function(d) {
return colorScale(d.properties.value);
})
.label(function(d) {
return "Population of" + d.properties.name + "(" + d.properties.value + ")";
})
.valFormatter(d3.format(".3s"))
//.onClick(function(d) {console.info(d)})
(document.getElementById(el.id));
var selectValue = 'value';
$('#select').on('change', function() {
selectValue = this.value;
carto
.value(function(d) {
return d.properties[selectValue];
});
});
If you want a more thorough example let me know.