Skip to content

Instantly share code, notes, and snippets.

@mlongoria
Created March 30, 2022 05:30
Show Gist options
  • Save mlongoria/0cfa11920dc4751cf44d32673e2a9123 to your computer and use it in GitHub Desktop.
Save mlongoria/0cfa11920dc4751cf44d32673e2a9123 to your computer and use it in GitHub Desktop.
Deneb JSON definition of bullet chart for Workout Wednesday 2022 Wk 13
{
"data": {"name": "dataset"},
"facet": {
"row": {
"field": "Metric",
"type": "ordinal" ,
"align": "all"
, "header": {"title": "", "labelAlign": "left", "labelAngle": 0, "labelFontSize": 20}
}
},
"spacing": 12,
"spec": {
"encoding": {
"x": {
"type": "quantitative",
"scale": {"nice": false},
"title": null
},
"y": {
"type": "nominal"
} ,
"tooltip": [
{
"field": "Actual"
}
,{
"field": "Goal"
}
,{
"field": "Prev Actual"
}]
},
"transform": [
{
"calculate": "datum['Metric Status Color']",
"as": "actual_color"
},
{
"calculate": "datum['Goal Status Color']",
"as": "goal_color"
}
],
"layer": [
{
"mark": {"type":"bar", "color":"#e6e6e6", "size": 30},
"encoding": {"x": {"field": "Background Bar"}}
},{
"mark": {"type":"bar", "color":"#7f8184", "size": 25},
"encoding": {"x": {"field": "Prev Actual"}}
},{
"mark": {
"type": "bar",
"color": {"expr": "datum['actual_color']"},
"size": 15},
"encoding": {"x": {"field": "Actual"}}
},{
"mark": {"type": "tick", "color": "black"},
"encoding": {"x": {"field": "Goal"}}
}]
},
"resolve": {"scale": {"x": "independent"}},
"config": {"tick": {"thickness": 3}}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment