【问题标题】:VEGA Json url loading failed from Github从 Github 加载 VEGA Json url 失败
【发布时间】:2022-01-09 18:34:59
【问题描述】:

我无法从 github 存储库将我的 json 文件加载到 VEGA 在线编辑器。 VEGA DATA 数组如下:

    "data": [
    {
      "name": "tree",
      "url": "https://github.com/omerakko/VEGA/blob/288ea5a5cc2a2e118eec6301f1b20288cffbef5b/vegaTreemapData.json",
      "format": {"type": "json", "parse": "auto"},
      "transform": [
        {"type": "stratify", "key": "id", "parentKey": "parent"},
        {
          "type": "treemap",
          "field": "percentage",
          "sort": {"field": "value"},
          "round": true,
          "method": {"signal": "layout"},
          "ratio": {"signal": "aspectRatio"},
          "size": [{"signal": "width"}, {"signal": "height"}]
        }
      ]
    },
    {"name": "testData", "source": "tree"},
    {
      "name": "nodes",
      "source": "tree",
      "transform": [{"type": "filter", "expr": "datum.children"}]
    },
    {
      "name": "leaves",
      "source": "tree",
      "transform": [{"type": "filter", "expr": "!datum.children"}]
    }
  ],

github目录设置为public。

我收到 [警告] 加载失败消息。 我是否缺少配置?

【问题讨论】:

    标签: vega


    【解决方案1】:

    编辑:答案是关于正确使用 github。 "url": "https://github.com/omerakko/VEGA/blob/288ea5a5cc2a2e118eec6301f1b20288cffbef5b/vegaTreemapData.json"指向html页面,而不是json文件。

    解决方案:通过点击“原始”按钮替换“url”链接,该按钮可用于github中的文件访问未预处理的数据

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-18
      • 2020-06-14
      • 1970-01-01
      • 2012-11-03
      • 2017-08-10
      • 1970-01-01
      相关资源
      最近更新 更多