vanCrimeTotalsType = VegaLite({
hconcat: [
{
"width": 200,
"height": 100,
"data": {
"values": vanCrime2,
"format":
{
type: "json",
"property": "features",
}
},
selection:
{
"highlight": {"type": "single", "empty": "none", "on": "mouseover"},
"select": {"type": "multi"}
},
mark: "bar",
encoding: {
color: {
condition: {
field: "Offense Type",
title: "Offense Type",
selection: "select",
type: "nominal"
},
value: "lightgray"
},
"tooltip":
[
{"field": "Offense Type", "title": "Offense Type","type": "nominal"},
{"field": "Offense", "title": "Offense","type": "nominal"},
],
x: {aggregate: "count", field: "Offense Type",type: "quantitative"},
y: {field: "Offense Type", type: "nominal"}
},
},
{
"width": 200,
"height": 100,
"data": {
"values": vanCrime,
"format":
{
type: "json",
"property": "features",
}
},
selection:
{
"highlight": {"type": "single", "empty": "none", "on": "mouseover"},
"select": {"type": "multi"}
},
mark: "bar",
size: {field: "properties.Offense", type: "quantitative"},
encoding: {
color: {
condition: {
field: "Offense Type",
scale: { "range": ['#ff0000', '#00aaff']},
title: "Offense Type",
selection: "select",
type: "nominal"
},
value: "lightgray"
},
x: {aggregate: "count", field: "Offense",type: "quantitative"},
y: {field: "Offense", type: "nominal"}
},
}]
})