Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/441.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 Internet explorer使用箭头函数返回语法错误_Javascript_Internet Explorer_D3.js - Fatal编程技术网

Javascript Internet explorer使用箭头函数返回语法错误

Javascript Internet explorer使用箭头函数返回语法错误,javascript,internet-explorer,d3.js,Javascript,Internet Explorer,D3.js,我正在尝试使用d3可视化,它在chrome中工作得非常完美,但InternetExplorer抛出了一个语法错误 错误出现在以下行: d=>color[d.primary] IE似乎不支持这种语法。有人能建议如何写吗?试试这样做 var bp=viz.bP() .data(data) .min(12) .pad(1) .height(h) .width(w)

我正在尝试使用d3可视化,它在chrome中工作得非常完美,但InternetExplorer抛出了一个语法错误

错误出现在以下行:

d=>color[d.primary]


IE似乎不支持这种语法。有人能建议如何写吗?

试试这样做

var bp=viz.bP()
            .data(data)
            .min(12)
            .pad(1)
            .height(h)
            .width(w)
            .barSize(35)
            .fill(function(d){
                return color[d.primary]
            });
此外,在将来,请查看以了解您可以在哪些浏览器中使用什么

var bp=viz.bP()
            .data(data)
            .min(12)
            .pad(1)
            .height(h)
            .width(w)
            .barSize(35)
            .fill(function(d){
                return color[d.primary]
            });