{
const regioes = vl.markGeoshape({fill: null, stroke: 'gray', strokeWidth: 0.3})
.data(vl.topojson(sp).mesh('regioes'));
const bubble = vl.markCircle()
.data(df)
.encode(
vl.longitude().fieldQ("Longitude"),
vl.latitude().fieldQ("Latitude"),
vl.color().fieldN("Regiao"),
vl.size().average("AverageCrimes").scale({range: [600, 6000]}).legend(null),
vl.opacity().value(0.8)
)
const lines = vl.markLine()
.data(df)
.encode(
vl.x().fieldN("Mes"),
vl.y().fieldQ("AverageCrimes").title("Média de homicídios anual"),
vl.color().fieldN("Regiao"),
vl.opacity().value(0.8)
);
const avgLine = vl.markLine()
.data(df)
.encode(
vl.x().fieldN("Mes"),
vl.y().average("AverageCrimes"),
vl.color().value("Black"),
vl.size().value(3)
);
return vl.hconcat(vl.layer(regioes, bubble)
.padding(0)
.width(300)
.config({view: {stroke: null}}),
vl.layer(lines,avgLine).title("Média de homicídios em preto"))
.title("Onde e quando é mais perigoso em São Paulo?")
.render()
}