Skip to content

Instantly share code, notes, and snippets.

@gdbassett
Created December 8, 2017 15:17
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 gdbassett/178a0506ffd7c05cb67e5c8c144ddce1 to your computer and use it in GitHub Desktop.
Save gdbassett/178a0506ffd7c05cb67e5c8c144ddce1 to your computer and use it in GitHub Desktop.
A DBIR bar chart in VEGA
{
"$schema": "https://vega.github.io/schema/vega/v3.0.json",
"width": 500,
"height": 309,
"autosize": "pad",
"data": [
{
"name": ".",
"format": {
"type": "csv",
"parse": {
"x": "number",
"n": "number",
"freq": "number"
}
},
"values": "\"enum\",\"x\",\"n\",\"freq\"\n\"Use of backdoor or C2\",679,895,0.75866\n\"Use of stolen creds\",643,895,0.71844\n\"Brute force\",80,895,0.08939\n\"SQLi\",26,895,0.02905\n\"Footprinting\",18,895,0.02011\n\"Abuse of functionality\",6,895,0.0067\n\"DoS\",5,895,0.00559\n\"Forced browsing\",4,895,0.00447\n\"RFI\",4,895,0.00447\n\"Other\",2,895,0.00223\n\"Session prediction\",2,895,0.00223"
}
],
"marks": [
{
"type": "rect",
"clip": false,
"encode": {
"update": {
"x": {
"scale": "y",
"value": 0
},
"x2": {
"field": "freq",
"scale": "y"
},
"y": {
"field": "enum",
"scale": "x"
},
"height": {
"scale": "x",
"band": "1"
}
}
},
"from": {
"data": "."
},
"interactive": true,
"name": "mark_791883058"
}
],
"scales": [
{
"name": "x",
"type": "band",
"domain": {
"data": ".",
"field": "enum"
},
"paddingInner": 0.1,
"paddingOuter": 0,
"range": "height",
"round": true
},
{
"name": "y",
"type": "linear",
"domain": {
"data": ".",
"field": "freq"
},
"range": "width",
"round": true
}
],
"axes": [
{
"scale": "y",
"orient": "bottom",
"format": "%",
"grid": true
},
{
"scale": "x",
"orient": "left"
}
],
"config": {
"autosize": "pad",
"events": {
"defaults": null
},
"mark": {
"fill": "#0088CE"
},
"axis": {
"ticks": false
},
"title": {
"anchor": "start"
}
},
"title": "Top Hacking varieties in breaches",
"mark": [
{
"type": "rect",
"clip": false,
"encode": {
"update": {
"x": {
"scale": "y",
"value": 0
},
"x2": {
"field": "freq",
"scale": "y"
},
"y": {
"field": "enum",
"scale": "x"
},
"height": {
"scale": "x",
"band": "1"
}
}
},
"from": {
"data": "."
},
"interactive": true,
"name": "mark_791883058",
"update": {
"strokeWidth": 0
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment