在将此图表从 D3.V3 更新到 D3.V4 时,我遇到了此错误:
TypeError: t.apply is not a function
https://jsfiddle.net/horacebury/bygscx8b/16/
我看不到在哪里更改代码,因为我实际上没有使用 D3 函数“apply”。 Angular 代码没有改变,并且在 D3.V3 上运行良好。
最佳答案
而不是这个(我认为它是 d3.v3 和 d3.v4 的混合):
var xAxis = d3.select(".axis").call(d3.axisBottom(x).ticks(5));
var xAxis = d3.select(".axis").call(d3.axisLeft(y).ticks(5));
应该如下所示(因为您使用 d3 v4)
var yAxis = d3.axisLeft(y).ticks(5);
var xAxis = d3.axisBottom(x).ticks(5)
工作代码here
关于angularjs - t.apply 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42411434/