map_view = {
const map = vl.markGeoshape({fill: '#ddd', stroke: '#fff', strokeWidth: 1})
.data(vl.topojson(topo).feature('chicago_neighborhoods'))
const circles = vl.markCircle({
size: 30,
opacity: 1,
stroke: '#000',
strokeWidth: 0.3
})
.data(crimes)
.transform(
vl.filter(selection)
)
.encode(
vl.latitude().fieldQ('Latitude'),
vl.longitude().fieldQ('Longitude'),
vl.color().fieldN("Primary Type")
.scale({
domain: ["HOMICIDE", "BURGLARY", "ROBBERY"],
range: ["#ab0768", "#169d99", "#b9cc01"]
}),
vl.tooltip([
{ field: "Primary Type", type: "nominal", title: "Crime Type" },
{ field: "Date", type: "temporal", timeUnit: "yearmonthdatehoursminutes", title: "Date & Time" }
])
)
return vl.layer(map, circles)
.project(
vl.projection('mercator')
)
.width(width*0.3)
.height(400)
}