我修改了这个示例Vega-Lite地图绘制https://vega.github.io/vega-lite/examples/geo_trellis.html,但没有显示任何内容,也没有错误。
以下是代码
"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
我不确定可能出了什么问题。谢谢你的帮助!
发布于 2020-06-09 14:21:46
您的数据包含缺少"id"条目的行,这会导致联接数据中的geo条目为空。如果您过滤掉这些无效值,则对于定义的行(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"
}
],

https://stackoverflow.com/questions/62272376
复制相似问题