Skip to content
Vega-Lite templates

Sports Science — Chart: Food Energy

Energy content of some foods.

Template previewVega-Lite
Rendering…

Make it your own.

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "description": "Energy per 100 g (kcal)",
  "data": {"values": [
    {"food": "Apple", "kcal": 52},
    {"food": "Rice (cooked)", "kcal": 130},
    {"food": "Chicken", "kcal": 165},
    {"food": "Cheese", "kcal": 400},
    {"food": "Almonds", "kcal": 579},
    {"food": "Olive oil", "kcal": 884}
  ]},
  "mark": "bar",
  "encoding": {
    "y": {"field": "food", "type": "nominal", "sort": "-x", "title": "Food"},
    "x": {"field": "kcal", "type": "quantitative", "title": "kcal per 100 g"},
    "color": {"field": "food", "type": "nominal", "legend": null}
  }
}