javascript 使 d3.js 兼容 IE8/IE9

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16828501/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 06:09:30  来源:igfitidea点击:

Making d3.js compatible with IE8/IE9

javascriptinternet-explorer-8internet-explorer-9d3.js

提问by Hitesh

I am using a Leaderboard from the following link

我正在使用以下链接中的排行榜

http://labs.juiceanalytics.com/leaderboard/index.html#2a65db98c6f451b7f071b630694bc350

http://labs.juiceanalytics.com/leaderboard/index.html#2a65db98c6f451b7f071b630694bc350

In this leaderboard d3.js and d3.csv.js are being used. This leaderboard is working fine for me in all the browsers except IE8 and IE9. For these browsers some error in scriptting is there with d3.js. I have searched it out well on internet but i didn't find any promising solution to make it work with IE8 or IE9. The error which it is showing is that "Object can't find the .map() method", which is used in d3.js. Glad if somebody can help me out in this.

在这个排行榜中使用了 d3.js 和 d3.csv.js。这个排行榜在除 IE8 和 IE9 之外的所有浏览器中对我来说都很好。对于这些浏览器,d3.js 存在一些脚本错误。我已经在互联网上很好地搜索了它,但我没有找到任何有希望的解决方案来使它与 IE8 或 IE9 一起工作。它显示的错误是“对象找不到 .map() 方法”,它在 d3.js 中使用。很高兴有人能帮我解决这个问题。

回答by minikomi

The author of d3 recommendsusing aightHTML5 shim/polyfill bundle for compatibility.

d3 的作者建议使用aightHTML5 shim/polyfill bundle 以实现兼容性。

The .map method in question is part of EcmaScript5 - and therefore not available in IE8.

有问题的 .map 方法是 EcmaScript5 的一部分 - 因此在 IE8 中不可用

Mozilla provides a function you can drop into get this functionality. Good luck with IE8!

Mozilla 提供了一个功能,您可以插入以获取此功能。祝 IE8 好运!