Skip to content

Instantly share code, notes, and snippets.

@humpydonkey
Created September 12, 2021 01:42
Show Gist options
  • Save humpydonkey/d03b8b1806133c7bf7fc4992dd49d3e4 to your computer and use it in GitHub Desktop.
Save humpydonkey/d03b8b1806133c7bf7fc4992dd49d3e4 to your computer and use it in GitHub Desktop.
vega lite layered bar chart
{
"config":
{
"background": "#ffffff",
"axis":
{
"labelColor": "#262730",
"titleColor": "#262730",
"gridColor": "rgba(38, 39, 48, 0.2)",
"labelFont": "IBM Plex Sans, sans-serif",
"titleFont": "IBM Plex Sans, sans-serif"
},
"legend":
{
"labelColor": "#262730",
"titleColor": "#262730",
"labelFont": "IBM Plex Sans, sans-serif",
"titleFont": "IBM Plex Sans, sans-serif"
},
"title":
{
"color": "#262730",
"subtitleColor": "#262730",
"labelFont": "IBM Plex Sans, sans-serif",
"titleFont": "IBM Plex Sans, sans-serif"
},
"view":
{
"continuousWidth": 400,
"continuousHeight": 300
}
},
"data":
{
"values":
[
{
"Year": 2018,
"Revenue": 110360000000,
"Earnings": 16571000000
},
{
"Year": 2019,
"Revenue": 125843000000,
"Earnings": 39240000000
},
{
"Year": 2020,
"Revenue": 143015000000,
"Earnings": 44281000000
},
{
"Year": 2021,
"Revenue": 168088000000,
"Earnings": 61271000000
}
]
},
"layer":
[
{
"mark": "bar",
"encoding":
{
"opacity":
{
"value": 1
},
"tooltip":
[
{
"type": "quantitative",
"field": "Year"
},
{
"type": "quantitative",
"field": "Revenue"
},
{
"type": "quantitative",
"field": "Earnings"
}
],
"x":
{
"type": "ordinal",
"field": "Year",
"title": ""
},
"y":
{
"type": "quantitative",
"field": "Revenue",
"title": ""
}
}
},
{
"mark":
{
"type": "bar",
"color": "orange"
},
"encoding":
{
"opacity":
{
"value": 1
},
"tooltip":
[
{
"type": "quantitative",
"field": "Year"
},
{
"type": "quantitative",
"field": "Revenue"
},
{
"type": "quantitative",
"field": "Earnings"
}
],
"x":
{
"type": "ordinal",
"field": "Year",
"title": ""
},
"y":
{
"type": "quantitative",
"field": "Earnings",
"title": ""
}
}
}
],
"height": 0,
"width": 660,
"$schema": "https://vega.github.io/schema/vega-lite/v4.8.1.json",
"autosize":
{
"type": "fit",
"contains": "padding"
},
"padding":
{
"bottom": 20
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment