map_view = {
const colors = {
domain: ["BURGLARY", "HOMICIDE", "ROBBERY"],
range: ["#FFD701", "#FF2200", "#3C72D6"]
};
const map = vl.markGeoshape({ fill: "#ddd", stroke: "#fff", strokeWidth: 1 })
.data(vl.topojson(topo).feature("chicago_neighborhoods"));
const circles = vl.markCircle({
fillOpacity: 0.5,
stroke: "#008246",
strokeWidth: 1,
strokeOpacity: 0.7,
})
.data(crimes)
.transform(vl.filter(brush))
.encode(
vl.latitude().fieldQ("Latitude"),
vl.longitude().fieldQ("Longitude"),
vl.color().fieldN("Primary Type").scale(colors),
vl.tooltip([
{field: 'Primary Type' },
{field: 'Date', type:'temporal', format: '%y/%m/%d - %H:%M'},
])
)
return vl.layer(map, circles)
.width(width / 3)
.height(600)
}