Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/395.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/85.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布局未定义_Javascript_Html_D3.js - Fatal编程技术网

Javascript d3布局未定义

Javascript d3布局未定义,javascript,html,d3.js,Javascript,Html,D3.js,正在尝试使用,但不确定如何正确引用: <!DOCTYPE html> <head> <link rel="stylesheet" href="bootstrap.min.css"> <script src="jquery-1.7.1.js"></script> <<<<other scripts>>> <script src="topbar.js"></script> &

正在尝试使用,但不确定如何正确引用:

<!DOCTYPE html>
<head>
<link rel="stylesheet" href="bootstrap.min.css">
<script src="jquery-1.7.1.js"></script>
<<<<other scripts>>>
<script src="topbar.js"></script>
<script>
$(function() {
    var n = 4, // number of layers
        m = 64, // number of samples per layer
     data = d3.layout.stack()(stream_layers(n, m, .1)),
    color = d3.interpolateRgb("#aad", "#556");
});
</script>
</head>
...
</html>


除了d3.js之外,还需要包括d3.layout.js;默认情况下,布局模块位于单独的文件中。您还可以定制d3.js版本,将所需的所有内容都包含在一个文件中。

(这不是这个问题的答案)

对于有相同错误的人:

d3.布局未定义

就我而言,问题在于我直接链接到最新版本(v4)

使用(v3)时,它再次工作。

您应该使用d3.stack

D34.0中的每个符号现在共享一个平面名称空间,而不是D33.x中的嵌套名称空间。例如,d3.scale.linear现在是d3.scaleLinear,而d3.layout.treemap现在是d3.treemap.


对于其他d3.layout更改,请转到此处:

与您引用其他JS的方式相同,请参见此处的v4+:(已更改,不再使用
.layout
-Tweak3r的答案解决了此问题)正确,但在包含布局后,我得到:d3.rebind在布局模块内不是一个函数错误。如何解决这个问题?我还有一个d3。重新绑定不是函数错误。。。我只能找到布局文件的一个链接。。。我正在使用d3 v4.1.1,但找不到布局模块的版本…它在哪里?抱歉。这个答案对于版本4是正确的