{
const mark_color = "#33ff33"
const brush = vl.selectInterval().encodings('x').resolve('intersect');
const object_hist = vl.markBar()
.encode(vl.x().fieldN('object_category').title('Object Category').axis({"labelAngle": 300}),
vl.y({"scale": {"domain": [1,10000], "type": "log"}}).count())
.width(300).height(180).title('Object Histogram');
const time_hist = vl.markBar()
.encode(vl.x().fieldT('date_full').timeUnit('yearmonthdate').title('Date'),
vl.y().count())
.width(412).height(170).title('Timeline (brush to select a date range!)');
const maplayer1= vl.markCircle()
.data(lucca)
.encode(
vl.latitude().fieldQ('lat'),
vl.longitude().fieldQ('lon'),
vl.size({'legend':{'values':[20,40,60,80,100,120,140]}}).count(),
vl.tooltip(['new_owner']),
vl.color().value('lightgrey')
).title("Map of Lucca (zoom with the 'scale' slider; pan with the 'x' and 'y' sliders; hover for town name)")
const maplayer2= vl.markCircle()
.data(lucca)
.transform(vl.filter(brush))
.encode(
vl.latitude().fieldQ('lat'),
vl.longitude().fieldQ('lon'),
vl.size({'legend':{'values':[5,10,15,20,25,30,35,40]}}).count(),
vl.tooltip(['town']),
vl.color().value('green')
)
const mapdata = vl.layer(
vl.markGeoshape({fill: '#e6f3ff'})
.data(vl.sphere()),
vl.markGeoshape({fill: '#2a1d0c', stroke: '#706545', strokeWidth: 0.75})
.data(vl.topojson(italy).feature('custom')),
maplayer1,maplayer2
)
.width(600).height(350)
.config({view: {stroke: null}}).project(projection)
const zoomedout =
vl.layer(
vl.markGeoshape({fill: '#e6f3ff'})
.data(vl.sphere()),
vl.markGeoshape({fill: '#2a1d0c', stroke: '#706545'})
.data(vl.topojson(italy).feature('custom')),
vl.markCircle()
.data(lucca).encode(
vl.latitude().fieldQ('lat'),
vl.longitude().fieldQ('lon'),
vl.color({"value": mark_color})
)
).width(190).project(thumbnail_projection).title("Static Map of Italy")
return vl.data(lucca)
.vconcat(vl.hconcat(mapdata, zoomedout),
vl.hconcat(time_hist.select(brush),
vl.layer(object_hist.encode(vl.color().value('lightgrey')),
object_hist.transform(vl.filter(brush))
)
)
)
.render();
}