Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

d3 V4.2.1 TypeScript 2.0 error importing d3-selection-multi

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?

like image 646
Dblock247 Avatar asked Oct 30 '22 22:10

Dblock247


1 Answers

The following should work

  import * as d3 from 'd3';
  import 'd3-selection-multi';
like image 156
user5325596 Avatar answered Nov 13 '22 16:11

user5325596