Skip to content

Instantly share code, notes, and snippets.

@atn832
Last active September 9, 2021 23:53
Show Gist options
  • Save atn832/c8cc7aa91ed14f80794e067015719415 to your computer and use it in GitHub Desktop.
Save atn832/c8cc7aa91ed14f80794e067015719415 to your computer and use it in GitHub Desktop.
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"width": 700,
"height": 800,
"padding": 5,
"title": "Graphics cards performance over time",
"data": [
{
"name": "thresholds",
"format": {
"type": "tsv",
"parse": "auto"
},
"url": "https://gist.githubusercontent.com/atn832/8a892db38bd1de09638c319a235aa82c/raw/4093f4b7ba829dca537f1110a56fdcabc8318565/Game%2520Performance%2520Thresholds.tsv"
},
{
"name": "table",
"format": {
"type": "tsv",
"parse": "auto"
},
"url": "https://gist.githubusercontent.com/atn832/7c0653a99f4101dc769df112e1e84b0a/raw/beda499a384ff42770d954fa5f0f144dfe18d1df/Graphics%2520cards%2520benchmark.tsv"
}
],
"scales": [
{
"name": "x",
"domain": {"data": "table", "field": "Year"},
"domainMin": 2013,
"round": true,
"nice": true,
"range": "width"
},
{
"name": "y",
"domain": {"data": "table", "field": "Bench score"},
"nice": true,
"range": "height"
},
{
"name": "color",
"type": "ordinal",
"range": "category",
"domain": {"data": "table", "field": "Type" }
},
{
"name": "game_color",
"type": "ordinal",
"range": { "scheme": "dark2"},
"domain": {"data": "thresholds", "field": "Game" }
}
],
"axes": [
{
"scale": "x",
"title": "Year",
"orient": "bottom"
},
{
"scale": "y",
"title": "Performance",
"orient": "left"
}
],
"marks": [
{
"type": "group",
"from": {
"facet": {
"data": "table",
"name": "facet",
"groupby": ["Type", "Tier"]
}
},
"marks": [
{
"type": "line",
"from": {"data": "facet"},
"encode": {
"enter": {
"x": {"scale": "x", "field": "Year"},
"y": {"scale": "y", "field": "Bench score"},
"stroke": {"scale": "color", "field": "Type"}
}
}
}
],
"legends": [
{
"title": "Platform",
"stroke": "color",
"symbolType": "stroke"
},
{
"title": "Game",
"stroke": "game_color",
"symbolType": "stroke"
}
]
},
{
"type": "symbol",
"from": {"data": "table"},
"encode": {
"enter": {
"x": {"scale": "x", "field": "Year"},
"y": {"scale": "y", "field": "Bench score"},
"fill": {"scale": "color", "field": "Type"},
"size": {"value": 50}
}
}
},
{
"type": "text",
"from": {"data": "table"},
"encode": {
"enter": {
"x": {"scale": "x", "field": "Year"},
"y": {"scale": "y", "field": "Bench score"},
"dy": { "value": -4},
"fill": { "value": "#000"},
"text": { "field": "Model"},
"align": {"value": "center"},
"baseline": {"value": "bottom"}
}
}
},
{
"type": "rule",
"from": {"data": "thresholds"},
"encode": {
"enter": {
"x": {"scale": "x", "value": 2013},
"x2": {"scale": "x", "value": 2021.2},
"y": {"scale": "y", "field": "Bench score"},
"stroke": { "scale": "game_color", "field": "Game"}
}
}
},
{
"type": "text",
"from": {"data": "thresholds"},
"encode": {
"enter": {
"x": {"scale": "x", "value": 2021.2},
"dx": { "value": 5},
"y": {"scale": "y", "field": "Bench score"},
"fill": { "scale": "game_color", "field": "Game"},
"text": { "field": "Performance"},
"align": {"value": "left"},
"baseline": {"field": "Baseline"}
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment