VegaLite({
data: {values: Population},
transform: [
{filter: "datum.year == 2000"},
{"calculate": "if(datum.sex==1,\"M\",\"F\")", "as": "gender"}
],
width: 20,
mark: "bar",
encoding: {
column: {field: "age", type: "ordinal", spacing: 10},
y: {aggregate: "sum", field: "people", type: "quantitative"},
x: {
field: "gender",
type: "nominal"
},
color: {field: "gender", type: "nominal", scale: {range: ["#EA98D2", "#659CCA"]}}
}
})