I modified this example Vega-Lite map plot https://vega.github.io/vega-lite/examples/geo_trellis.html but nothing shows up, and there are no errors.
Here is the code
"transform": [
{
"lookup": "id",
"from": {
"data": {
"url": "data/us-10m.json",
"format": {"type": "topojson", "feature": "states"}
},
"key": "id"
},
"as": "geo"
}
],
"projection": {"type": "albersUsa"},
"mark": "geoshape",
"encoding": {
"shape": {"field": "geo", "type": "geojson"},
"color": {"field": "count", "type": "quantitative"}
}
Open the Chart in the Vega Editor
I'm not sure what could possibly be wrong. Thanks for the help!
Your data contains rows that are missing the "id"
entry, which leads to null geo
entries in the joined data. If you filter out these invalid values, it works as expected for the defined rows ( vega editor ):
"transform": [
{"filter": "isValid(datum.id)"},
{
"lookup": "id",
"from": {
"data": {
"url": "data/us-10m.json",
"format": {"type": "topojson", "feature": "states"}
},
"key": "id"
},
"as": "geo"
}
],
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.