mapchoro = vl.markGeoshape({stroke: '#888', strokeWidth: 0.25})
.data(bairros.features)
.transform(
vl.lookup('properties.NOME')
.from(vl.data(homicides)
.key('Bairro')
.fields('Bairro', 'Homicidios')),
vl.lookup('properties.NOME')
.from(vl.data(homicides_fortal)
.key('Bairro')
.fields('Populacao')),
vl.calculate('(datum.Homicidios/datum.Populacao)*100000').as('taxa_h')
)
.encode(
vl.color().fieldQ('taxa_h').scale({domain: [0, 200], type: 'quantize', clamp: true, scheme: {name: 'oranges', count: 8}}).legend({title: "Homicídios por 100 mil habitantes"}),
vl.tooltip(['Bairro','Populacao','Homicidios',{field: "taxa_h", title: "Homicídios por 100 mil habitantes", format: ".0f"}])
)
.project(vl.projection('mercator'))
.width(850).height(500)
.render()