Created
March 5, 2018 21:26
-
-
Save manuelroth/962eb299e6d59b038779e7857cd64b3f to your computer and use it in GitHub Desktop.
Vega: Projection property fit "Unsupported parameter object" error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$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