Using d3.js in Angular 2 App

ank5 used Ask the Experts™
In an Angular 2 app, I need to create a graph using D3.js.

In order to get the D3 JS files, I did a "npm install d3". however, it created lots of folders inside node_modules. I am not able to make out which ones to use.

In the past (in an Ext JS application), I have just included d3.js in the script tag and that made 'd3' available for me to use.

Is that not the case when using node modules? What is the best way to use d3 with angular 2?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2017
Distinguished Expert 2018
I have not used d3 with angular but did an npm install of d3 - looks like what you are looking for is

node_modules\d3\build\d3.js or

One option is to use the above - I have seen some samples that get d3 directly from CDN example
<script src="" charset="utf-8"></script>

It comes down to how you are packaging and deploying your app.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial