LoginSignup
2
2

More than 5 years have passed since last update.

typescript + d3.js v4でd3.select().transitionを機能させる

Posted at

d3.js v4で詰まったのでメモ。

d3.js v4で機能がモジュール毎に分割されたが、DOMセレクト機能モジュールである d3-select をインポートしてDOMを選択した際、アニメーションを実行するtransitionメソッドを実行しようとすると

Uncaught TypeError: n.selector.transition is not a function

というようなエラーが出て実行出来ない。

v4からは d3-transitionは分割されており別途importする必要がある。

import 'd3-transition';

としてimportしてやるとtranstionは機能する。

参照: https://github.com/tomwanzek/d3-v4-definitelytyped/issues/117

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2