I am trying to import d3 v4 into a typescript project using jspm and systemjs. I can get d3 imported correctly using this
import * as d3 from 'd3';
This works and it allows me to make selections etc. I tried using the attr function and passing it an object which did not work. I found that d3 v4 includes that as a separate module.
After downloading that module d3-selection-multi with jspm. I try to import it into my project like so.
import * as d3 from 'd3';
import 'jspm_packages/npm/[email protected]';
I then try and use the attrs function but the console logs the following error
(index):40 Error: (SystemJS) d3.selectAll(...).data(...).style(...).attrs is not a function(…)
I am also getting some compile error which i get all the time but yet they always still compile and the code runs
error TS2307: Cannot find module 'd3'
error TS1110: Type expected
Can any one explain what I am doing wrong and offer a solution?
The following should work
import * as d3 from 'd3';
import 'd3-selection-multi';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With