首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Vega-Lite地图没有显示,没有错误

Vega-Lite地图没有显示,没有错误
EN

Stack Overflow用户
提问于 2020-06-09 06:47:36
回答 1查看 367关注 0票数 1

我修改了这个示例Vega-Lite地图绘制https://vega.github.io/vega-lite/examples/geo_trellis.html,但没有显示任何内容,也没有错误。

以下是代码

代码语言:javascript
复制
  "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

我不确定可能出了什么问题。谢谢你的帮助!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-06-09 14:21:46

您的数据包含缺少"id"条目的行,这会导致联接数据中的geo条目为空。如果您过滤掉这些无效值,则对于定义的行(vega editor),它将按预期工作:

代码语言:javascript
复制
"transform": [
    {"filter": "isValid(datum.id)"},
    {
      "lookup": "id",
      "from": {
        "data": {
          "url": "data/us-10m.json",
          "format": {"type": "topojson", "feature": "states"}
        },
        "key": "id"
      },
      "as": "geo"
    }
  ],

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62272376

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档