Skip to content

Instantly share code, notes, and snippets.

@Dulani
Last active April 26, 2022 01:55
Show Gist options
  • Save Dulani/a9b017cf43f42a63ee099f68c67da3f9 to your computer and use it in GitHub Desktop.
Save Dulani/a9b017cf43f42a63ee099f68c67da3f9 to your computer and use it in GitHub Desktop.
Vertical rule using datasets
/* Vertical rule using datasets */
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"datasets": {
"linedata": [
{"a": 1, "b": 30},
{"a": 2, "b": 45},
{"a": 3, "b": 50},
{"a": 4, "b": 60},
{"a": 5, "b": 70},
{"a": 6, "b": 80},
{"a": 7, "b": 70},
{"a": 8, "b": 50},
{"a": 9, "b": 10}
],
"ruledata": {"ownval":5}
},
"layer": [
{
"data": {"name": "linedata"},
"mark": {"type":"line", "size": 2},
"encoding": {
"x": {"field": "a", "type": "quantitative"},
"y": {"field": "b", "type": "quantitative"}
}
},
{
"data": {"name": "ruledata"},
"mark": {"type": "rule", "strokeDash": [4, 4], "size": 2, "color": "grey"},
"encoding": {
"x": {"field": "ownval", "type": "quantitative"}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment