【发布时间】:2019-09-02 11:29:20
【问题描述】:
我想使用来自 API 的 JSON 数据并在图表中使用它。为此,我这样做了:
d3.request (url hidden)
.mimeType ("application / json")
.response (function (xhr) {return JSON.parse (xhr.responseText);});
但我收到此错误“d3.request is not a function”我做错了什么?
【问题讨论】:
-
很可能,您使用的是 D3 v5。但是,从 v5 开始,d3-request 模块已被弃用,完整包中的 dropped 已被弃用。您需要切换到 v5 采用的 Fetch API 或单独导入模块 d3-request。