{
  "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
  "description": "A bar chart showing the US population distribution of age groups and gender in 2000.",
  "data": {"url": "data/population.json"},
  "transform": [
    {
      "calculate": "datum.sex == 2 ? 'Female' : 'Male'",
      "as": "gender"
    }
  ],
  "width": {"step": 17},
  "mark": "bar",
  "encoding": {
    "x": {
      "field": "age",
      "type": "ordinal"
    },
    "y": {
      "aggregate": "sum",
      "field": "people",
      "type": "quantitative",
      "axis": {"title": "population"},
      "stack": null
    },
    "color": {
      "field": "gender",
      "type": "nominal",
      "scale": {"range": ["#e377c2","#1f77b4"]}
    },
    "opacity": {"value": 0.7}
  }
}
