Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/457.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript (匿名函数)D3.Js错误_Javascript_D3.js - Fatal编程技术网

Javascript (匿名函数)D3.Js错误

Javascript (匿名函数)D3.Js错误,javascript,d3.js,Javascript,D3.js,当使用D3.Js并遵循本教程时,我在控制台中得到了错误(匿名函数)。第20行有:canvas.selectALL 谁能给我指出正确的方向吗 <script> d3.json("document.json", function (data) { var canvas = d3.select("body").append("svg") .attr("width", 500) .attr("height", 500

当使用D3.Js并遵循本教程时,我在控制台中得到了错误(匿名函数)。第20行有:canvas.selectALL

谁能给我指出正确的方向吗

<script>

    d3.json("document.json", function (data) {

        var canvas = d3.select("body").append("svg")
            .attr("width", 500)
            .attr("height", 500)

        canvas.selectALL("rect")
            .data(data)
            .enter()
                .append("rect")
                .attr("width", function (d) { return d.age * 10; })
                .attr("height", 50)
                .attr("y", function (d, i) { return i * 50; })
                .attr("fill", "blue")       
    })
</script>

d3.json(“document.json”),函数(数据){
var canvas=d3.select(“body”).append(“svg”)
.attr(“宽度”,500)
.attr(“高度”,500)
canvas.selectALL(“rect”)
.数据(数据)
.输入()
.append(“rect”)
.attr(“宽度”,函数(d){返回d.age*10;})
.attr(“高度”,50)
.attr(“y”,函数(d,i){返回i*50;})
.attr(“填充”、“蓝色”)
})

如果您可以发布出现错误的代码,那会很有帮助。应该是
选择all
(小写l)。在学习第三方教程时,阅读官方API文档也很有用。