Skip to content

Instantly share code, notes, and snippets.

@op8867555
Created August 11, 2017 01:59
Show Gist options
  • Save op8867555/5af6189b957373bf0ff9969c8e3d426a to your computer and use it in GitHub Desktop.
Save op8867555/5af6189b957373bf0ff9969c8e3d426a to your computer and use it in GitHub Desktop.
COSCUP 2017 議程表 in VEGA
{
"$schema": "https://vega.github.io/schema/vega/v3.0.json",
"width": 480,
"height": 1600,
"padding": 50,
"data":[
{ "name": "table",
"url": "https://coscup.org/2017-assets/json/submissions.json",
"format": {"type":"json", "parse":{"start":"date", "end": "date"}},
"transform": [
{
"type": "filter",
"expr": "datum.start >= datetime(2017, 8-1, day) && datum.end < datetime(2017, 8-1,day+1)"
}
]
}
],
"scales": [
{
"name": "xscale",
"type": "band",
"domain": {"data": "table", "field": "room", "sort": true},
"range": "width"
},
{
"name": "yscale",
"type": "time",
"domain": {"data": "table", "fields": ["start", "end"]},
"range": "height",
"reverse": true
},
{
"name": "color",
"type": "ordinal",
"domain": {"data": "table", "field": "community"},
"range": {"scheme": "category20"}
}
],
"axes": [
{ "orient": "top", "scale": "xscale" },
{ "orient": "bottom", "scale": "xscale" },
{ "orient": "left", "scale": "yscale" }
],
"marks": [
{
"type": "rect",
"from": {"data":"table"},
"encode": {
"enter": {
"tooltip": {"field": "subject"},
"fill": {"scale": "color", "field": "community"}
},
"update": {
"xc": {"scale": "xscale", "field": "room", "band":0.5},
"width": {"scale": "xscale", "band": 0.5},
"y": {"scale": "yscale", "field": "start"},
"y2": {"scale": "yscale", "field": "end"}
}
}
}
],
"signals": [
{
"name": "day",
"value": 5,
"bind": {"input": "radio", "options": [5, 6]}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment