Skip to content

Instantly share code, notes, and snippets.

@philz
Created May 18, 2022 02:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philz/6bc760991d9fa2085f963ea3aa47c79f to your computer and use it in GitHub Desktop.
Save philz/6bc760991d9fa2085f963ea3aa47c79f to your computer and use it in GitHub Desktop.
Vegalite Timeline Example
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "Timeline",
"title": "Hey there",
"width": 600,
"height": 200,
"data": {
"values": [
{"idx": 0, "start": 0, "name": "Took a minute", "end": 60000},
{"idx": 1, "start": 60000, "name": "Took half a minute", "end": 90000},
{
"idx": 2,
"start": 60000,
"name": "Overlapped with previous",
"end": 70000
},
{"idx": 3, "start": 60500, "name": "Same lane", "end": 70000},
{"idx": 4, "start": 80500, "name": "Same lane", "end": 90500}
]
},
"mark": "bar",
"encoding": {
"y": {"field": "name", "type": "ordinal", "sort": null, "title": "hi"},
"x": {"field": "start", "timeUnit": "minutesseconds"},
"x2": {"field": "end", "timeUnit": "minutesseconds"},
"color": {"field": "idx", "legend": null},
"tooltip": {"field": "name"}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment