Using d3.js in Angular 2 App

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?
LVL 1
ank5Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
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
node_modules\d3\build\d3.min.js

One option is to use the above - I have seen some samples that get d3 directly from CDN example
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js" charset="utf-8"></script>

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
D3.js

From novice to tech pro — start learning today.