Skip to content

Instantly share code, notes, and snippets.

@randyzwitch
Last active October 6, 2015 17:42
Show Gist options
  • Select an option

  • Save randyzwitch/d21302555eedcc088ade to your computer and use it in GitHub Desktop.

Select an option

Save randyzwitch/d21302555eedcc088ade to your computer and use it in GitHub Desktop.
Vega waterfall plot
{
"name": "Vega Visualization",
"height": 450,
"padding": "auto",
"marks": [
{
"properties": {
"enter": {
"x": {
"offset": 31,
"field": "x",
"scale": "x"
},
"y2": {
"field": "y2",
"scale": "y"
},
"width": {
"mult": 0.5,
"scale": "x",
"band": true
},
"fill": {
"field": "group",
"scale": "group"
},
"y": {
"field": "y",
"scale": "y"
}
}
},
"from": {
"data": "table"
},
"type": "rect"
}
],
"axes": [
{
"format": "",
"layer": "front",
"properties": {
"title": {
"fontSize": {
"value": 14
}
}
},
"title": "",
"grid": false,
"type": "x",
"scale": "x",
"ticks": 0
},
{
"titleOffset": 40,
"format": "",
"layer": "front",
"properties": {
"title": {
"fontSize": {
"value": 14
}
}
},
"title": "",
"grid": false,
"type": "y",
"scale": "y",
"ticks": 0
}
],
"data": [
{
"name": "table",
"values": [
{
"x": "Product Revenue",
"y2": 0,
"group": 0,
"y": 420000
},
{
"x": "Services Revenue",
"y2": 420000,
"group": 0,
"y": 630000
},
{
"x": "Fixed Costs",
"y2": 630000,
"group": 1,
"y": 460000
},
{
"x": "Variable Costs",
"y2": 460000,
"group": 1,
"y": 320000
},
{
"x": "One-Time Costs",
"y2": 320000,
"group": 1,
"y": 245000
},
{
"x": "Total",
"y2": 0,
"group": 2,
"y": 245000
}
]
}
],
"scales": [
{
"name": "x",
"range": "width",
"domain": {
"data": "table",
"field": "x"
},
"type": "ordinal"
},
{
"name": "y",
"range": "height",
"domain": {
"data": "table",
"field": "y"
},
"type": "linear"
},
{
"name": "group",
"range": [
"#4daf4a",
"#e41a1c",
"#377eb8"
],
"domain": {
"data": "table",
"field": "group"
},
"type": "ordinal"
}
],
"width": 660,
"legends": []
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment