Skip to content

Instantly share code, notes, and snippets.

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 manuelroth/962eb299e6d59b038779e7857cd64b3f to your computer and use it in GitHub Desktop.
Save manuelroth/962eb299e6d59b038779e7857cd64b3f to your computer and use it in GitHub Desktop.
Vega: Projection property fit "Unsupported parameter object" error
{
"$schema": "https://vega.github.io/schema/vega/v3.json",
"width": 960,
"height": 500,
"autosize": "none",
"data": [
{
"name": "unemp",
"url": "data/unemployment.tsv",
"format": {"type": "tsv", "parse": "auto"}
},
{
"name": "counties",
"url": "data/us-10m.json",
"format": {"type": "topojson", "feature": "counties"},
"transform": [
{ "type": "lookup", "from": "unemp", "key": "id", "fields": ["id"], "values": ["rate"] },
{ "type": "filter", "expr": "datum.rate != null" }
]
}
],
"projections": [
{
"name": "projection",
"type": "albersUsa",
"fit": {}
}
],
"scales": [
{
"name": "color",
"type": "quantize",
"domain": [0, 0.15],
"range": {"scheme": "blues-9"}
}
],
"legends": [
{
"fill": "color",
"orient": "bottom-right",
"title": "Unemployment",
"format": "0.1%",
"encode": {
"symbols": {
"update": {
"shape": {"value": "square"},
"stroke": {"value": "#ccc"},
"strokeWidth": {"value": 0.2}
}
}
}
}
],
"marks": [
{
"type": "shape",
"from": {"data": "counties"},
"encode": {
"enter": { "tooltip": {"signal": "format(datum.rate, '0.1%')"}},
"update": { "fill": {"scale": "color", "field": "rate"} },
"hover": { "fill": {"value": "red"} }
},
"transform": [
{ "type": "geoshape", "projection": "projection" }
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment