Vega-Lite 地图没有正确显示
Vega-Lite map not showing up with no error
我修改了这个示例 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
我不确定可能出了什么问题。感谢您的帮助!
您的数据包含缺少 "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"
}
],
我修改了这个示例 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
我不确定可能出了什么问题。感谢您的帮助!
您的数据包含缺少 "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"
}
],