Skip to content

Instantly share code, notes, and snippets.

@Masa331
Last active October 25, 2022 13:01
Show Gist options
  • Save Masa331/741b30031a65dc321b4f46d786b2d88e to your computer and use it in GitHub Desktop.
Save Masa331/741b30031a65dc321b4f46d786b2d88e to your computer and use it in GitHub Desktop.
Vega-Lite spec from Tue Oct 25 2022
{
"config": { "customFormatTypes": true },
"width": { "step": 20 },
"data": {
"values": [{"date":"2022-10-01","duration":0},{"date":"2022-10-02", "duration":0},{"date":"2022-10-03","duration":3},{"date":"2022-10-04","duration":6},{"date":"2022-10-05","duration":10},{"date":"2022-10-06","duration":12},{"date":"2022-10-07","duration":11},{"date":"2022-10-08","duration":0},{"date":"2022-10-09","duration":0},{"date":"2022-10-10","duration":6},{"date":"2022-10-11","duration":7},{"date":"2022-10-12","duration":10},{"date":"2022-10-13","duration":17},{"date":"2022-10-14","duration":10},{"date":"2022-10-15","duration":0},{"date":"2022-10-16","duration":2},{"date":"2022-10-17","duration":3},{"date":"2022-10-18","duration":11},{"date":"2022-10-19","duration":3},{"date":"2022-10-20","duration":19},{"date":"2022-10-21","duration":15},{"date":"2022-10-22","duration":0},{"date":"2022-10-23","duration":0},{"date":"2022-10-24","duration":4},{"date":"2022-10-25","duration":0},{"date":"2022-10-26","duration":0},{"date":"2022-10-27","duration":0},{"date":"2022-10-28","duration":0},{"date":"2022-10-29","duration":0},{"date":"2022-10-30","duration":0},{"date":"2022-10-31","duration":0}]
},
"mark": {
"type": "line",
"point": { "size": 80 },
"tooltip": true
},
"encoding": {
"x": {
"field": "date",
"type": "ordinal",
"timeUnit": "yearmonthdate",
"title": "Den",
"axis": {
"labelAngle": 45,
"labelOverlap": false,
"format": "%d.%m.%Y (%a)",
"labelColor": {
"value": "black",
"condition": [{ "test": { "field": "value", "timeUnit": "day", "equal": 5 }, "value": "grey" },
{ "test": { "field": "value", "timeUnit": "day", "equal": 6 }, "value": "grey" }]
},
"labelExpr": "if(timeFormat(datum.value, '%d.%m.%Y') == '01.10.2022', '🚗' + ' ' + timeFormat(datum.value, '%d.%m.%Y (%a)'), timeFormat(datum.value, '%d.%m.%Y (%a)'))"
}
},
"y": {
"type": "quantitative",
"field": "duration",
"title": "Strávený čas",
"scale": { "domain": [0, 40] }
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment