Skip to content

Latest commit

 

History

History
executable file
·
50 lines (28 loc) · 2.19 KB

README.md

File metadata and controls

executable file
·
50 lines (28 loc) · 2.19 KB

Using D3.js version 4 with Angular 4...

Updated to use Angular 4, Angular CLI 1.0.4, and the latest d3. I need to get around to updating the map component and overall validation of the approach. Since Angular wants to abstract the DOM from the developer, there's a way to get D3 access to it and I'll get it right soon.

Simple example of creating a reusable D3 chart component.

screenshot

See http://keathmilligan.net/create-reusable-chart-components-with-angular-2-and-d3-js-version-4/ for more information about this example.

UPDATES: (b4youleap)

Original commit - trying to adapt this approach to create a reusable map component... and then read data from an API.

12/30/2016 - I just learned that shared components can (at least enforced by cli) only be exposed via modules. This new version adds a shared module and exposes the components via that module.

I've also reinstalled d3 using typings using the following commands: npm install d3 --save npm install @types/d3 --save-dev

This project was originally generated with angular-cli version 1.0.0-beta.17. It was then updated to use version 1.0.0-beta.24

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive/pipe/service/class.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the -prod flag for a production build.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor. Before running the tests make sure you are serving the app via ng serve.

Deploying to Github Pages

Run ng github-pages:deploy to deploy to Github Pages.

Further help

To get more help on the angular-cli use ng --help or go check out the Angular-CLI README.