VEGA Json url 从 Github 加载失败
VEGA Json url loading failed from Github
我无法将 json 文件从 github 存储库加载到 VEGA 在线编辑器。下面的 VEGA 数据数组:
"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.
我收到一条[警告] 加载失败的消息。
我是否缺少配置?
编辑:答案是关于正确使用 github。
"url": "https://github.com/omerakko/VEGA/blob/288ea5a5cc2a2e118eec6301f1b20288cffbef5b/vegaTreemapData.json"
指向 html 页面,而不是 json 文件。
解决方案:通过单击 github 中文件可用的“原始”按钮来替换“url”link,以访问未预处理的数据
我无法将 json 文件从 github 存储库加载到 VEGA 在线编辑器。下面的 VEGA 数据数组:
"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.
我收到一条[警告] 加载失败的消息。 我是否缺少配置?
编辑:答案是关于正确使用 github。
"url": "https://github.com/omerakko/VEGA/blob/288ea5a5cc2a2e118eec6301f1b20288cffbef5b/vegaTreemapData.json"
指向 html 页面,而不是 json 文件。
解决方案:通过单击 github 中文件可用的“原始”按钮来替换“url”link,以访问未预处理的数据