0

我正在尝试在 IE8 中使用r2d3来绘制多系列折线图。

在 IE8 中加载页面时,出现以下错误:

TypeError: Unable to get property 'attr' of undefined or null reference undefined

这是由以下 d3 代码触发的:

chart.areas.grid = chart.base.append('g')
  .classed('grid', true)
  .attr('width', chart.margins.left - chart.margins.right)
  .attr('height', chart.h - chart.margins.bottom - chart.margins.top)
  .attr('transform', 'translate(' + chart.margins.left + ',0)'); 

如果我将“g”元素替换为其他元素,代码将继续到下一个“g”元素并引发相同的错误。

考虑到其他人已经在 IE8 中通过 r2d3 成功使用了“g”元素,我无法弄清楚是什么原因造成的。

我还在使用相对较新的框架d3.chart,它刚刚开始提供 IE8 支持。然而,这似乎不太可能导致问题,因为触发问题的代码是纯 d3。

4

0 回答 0