Skip to content

Instantly share code, notes, and snippets.

@matthijskooijman
Created December 8, 2020 14:52
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 matthijskooijman/6785f8bdc06218a9f678b91604636959 to your computer and use it in GitHub Desktop.
Save matthijskooijman/6785f8bdc06218a9f678b91604636959 to your computer and use it in GitHub Desktop.
MJS2020 solar testje @ DeWAR
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"description": "MJS2020 data",
"data": {
"url": "https://meetjestad.net/data/?type=sensors&ids=2001,2003,2004,2005,2006&begin=2020-12-05,00:00&format=json"
},
"transform": [{"calculate": "datum.extra[9]/1000", "as": "solar"}],
"config": {"mark": {"tooltip": {"content": "data"}}, "point": {"size": 1}},
"facet": {"field": "id"},
"spec": {
"vconcat": [
{
"title": "Drag to zoom, click to reset",
"width": 500,
"height": 50,
"mark": {
"type": "point",
"color": "red",
"tooltip": {"content": "data"}
},
"encoding": {
"x": {"field": "timestamp", "type": "temporal"},
"y": {
"field": "temperature",
"type": "quantitative",
"axis": {"titleColor": "red"},
"scale": {"zero": false}
}
},
"selection": {"daterange": {"type": "interval", "encodings": ["x"]}}
},
{
"title": "Temperature & Humidity",
"width": 500,
"height": 200,
"encoding": {
"x": {
"field": "timestamp",
"type": "temporal",
"scale": {"domain": {"selection": "daterange"}}
}
},
"layer": [
{
"mark": {"type": "point", "color": "red"},
"encoding": {
"y": {
"field": "temperature",
"type": "quantitative",
"axis": {"titleColor": "red"}
}
},
"selection": {"dummy_to_fix_tooltip": {"type": "interval"}}
},
{
"mark": {"type": "point", "color": "blue"},
"encoding": {
"y": {
"field": "humidity",
"type": "quantitative",
"axis": {"titleColor": "blue"}
}
},
"selection": {"dummy_to_fix_tooltip2": {"type": "interval"}}
}
],
"resolve": {"scale": {"y": "independent"}}
},
{
"title": "Voltages",
"width": 500,
"height": 200,
"transform": [
{"fold": ["supply", "battery", "solar"], "as": ["field", "voltage"]}
],
"mark": {"type": "point", "color": "red"},
"encoding": {
"x": {
"field": "timestamp",
"type": "temporal",
"scale": {"domain": {"selection": "daterange"}}
},
"y": {"field": "voltage", "type": "quantitative"},
"color": {"field": "field", "legend": {"title": "Voltages"}}
},
"selection": {"dummy_to_fix_tooltip": {"type": "interval"}}
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment