Skip to content

Instantly share code, notes, and snippets.

@digi0ps
Created March 30, 2018 08:32
Show Gist options
  • Save digi0ps/476fec9c6d0e28c23e1225c7874f3474 to your computer and use it in GitHub Desktop.
Save digi0ps/476fec9c6d0e28c23e1225c7874f3474 to your computer and use it in GitHub Desktop.
{
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
"data": {
"url": "https://gist.githubusercontent.com/digi0ps/d53b23e2bf308e229da838827b5717c2/raw/320a194204649b1a05eac1e08ec990384f5dd19c/dupbup.csv",
"format": {
"type": "csv"
}
},
"width": 800,
"height": 400,
"layer": [
{
"encoding": {
"x": {
"field": "Station",
"type": "ordinal"
},
"y": {
"field": "Delay",
"type": "quantitative"
},
"color": {
"field": "Train",
"type": "nominal"
}
},
"layer": [
{
"mark": "line"
},
{
"selection": {
"tooltip": {
"type": "single",
"nearest": true,
"on": "mouseover",
"encodings": [
"x"
],
"empty": "none",
"resolve": "global"
}
},
"mark": "point",
"encoding": {
"opacity": {
"condition": {
"selection": "tooltip",
"value": 1
},
"value": 0
}
}
}
]
},
{
"transform": [
{
"filter": {
"selection": "tooltip"
}
}
],
"layer": [
{
"mark": {
"type": "rule",
"color": "gray"
},
"encoding": {
"x": {
"type": "ordinal",
"field": "Station"
}
}
},
{
"mark": {
"type": "text",
"align": "left",
"dx": 5,
"dy": -5
},
"encoding": {
"text": {
"type": "quantitative",
"field": "Delay"
},
"color": {
"type": "nominal",
"field": "Train"
},
"x": {
"type": "ordinal",
"field": "Station"
},
"y": {
"type": "quantitative",
"field": "Delay"
}
}
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment