【问题标题】:mpld3 interactive legend does not work in IEmpld3 交互式图例在 IE 中不起作用
【发布时间】:2017-07-18 12:35:29
【问题描述】:

我在 python 中使用 mpld3 库,我注意到 Internet Explorer 上的交互式图例插件不起作用。

我也注意到mpld3网站上,交互式图例的例子在IE中也不起作用。

所以我有点卡在这里......有什么帮助吗?you can see on that image that the interactive legend does not work

我还将把mpld3交互式插件链接放在这里:https://mpld3.github.io/examples/interactive_legend.html

【问题讨论】:

  • 如果您的问题中没有任何代码,人们将很难为您提供帮助。到目前为止,您做了哪些研究?您尝试的 IE 版本是否支持此功能?考虑阅读本文并编辑您的问题stackoverflow.com/help/how-to-ask
  • 代码在链接中,我认为 IE 可能不支持此功能,但文档中未指定。这就是我在这里问的原因
  • 其实是在为页面生成的代码中提到的。 console.log(type + " is not yet supported"); ,更不用说它也无济于事。也许您需要记录type 并尝试手动使用它。

标签: javascript python internet-explorer d3.js mpld3


【解决方案1】:

mpld3/plugins.py 中的以下代码行导致 IE 不兼容:

  • 582行var type = d.mpld3_elements[i].constructor.name
  • 614行var type = d.mpld3_elements[0].constructor.name

将它们替换为:

  • var type = d.mpld3_elements[i].constructor.toString().match(/^function\s*([^\s(]+)/)[1];
  • var type = d.mpld3_elements[0].constructor.toString().match(/^function\s*([^\s(]+)/)[1];

取自https://github.com/mpld3/mpld3/issues/191

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-09-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多