小编Jer*_* Ng的帖子

d3过渡不是一个功能

我的D3代码有问题.

const hexagon = this.hexagonSVG.append('path')
  .attr('id', 'active')
  .attr('d', lineGenerator(<any>hexagonData))
  .attr('stroke', 'url(#gradient)')
  .attr('stroke-width', 3.5)
  .attr('fill', 'none')

const totalLength = (<any>hexagon).node().getTotalLength()

const _transition = this.d3.transition()
  .duration(DASH_ANIMATION)
  .ease(this.d3.easeLinear)

hexagon
  .attr('stroke-dasharray', totalLength + ' ' + totalLength)
  .attr('stroke-dashoffset', totalLength)
  .attr('stroke-dashoffset', 0)
  .transition(_transition)
Run Code Online (Sandbox Code Playgroud)

这个代码在将近6个月的时间里运行良好,但今天出现了一个错误.

"hexagon.attr(...).attr(...).attr(...).transition不是函数"

有人可以告诉我如何解决这个问题吗?谢谢.

d3.js typescript

6
推荐指数
1
解决办法
1682
查看次数

标签 统计

d3.js ×1

typescript ×1