import * as D3 from 'd3'; in my custom area-cart.component.ts, and no complains from compiler.
In package.json I have:
"@types/d3": "^3.5.38", "d3": "^3.5.17",
Version 3 seems working fine. Do you really need D3 v4?
You can try:
import * as d3selection from 'd3-selection'; import 'd3-transition'; d3selection.select(...)
You're using v4.2.x of d3 but the typings are for v3.5.x. Refer to https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11367 for an explanation about why the default version is 3.x.
This D3 Standard bundle is published as a UMD module of name d3. Currently, the definitions for this standard bundle cannot be published in DefinitelyTyped/types-2.0 (see closed PR #10453) due to existing dependencies of other libraries on the legacy D3 v3.x definitions (e.g. plottable, nvd3) contained in the same directory.
With the sincerest hope that it remains a temporary workaround, developers who need a definition file representing the D3 version 4 may proceed as follows:
Install the module-level definitions for the D3 modules comprising the D3 standard bundle individually, using e.g.
npm install @types/d3-selection --save
Alternatively, if it works for your use case you could try angular2 d3 service: https://github.com/tomwanzek/d3-ng2-service
- Properly install D3 v4 into Angular2
- How to get background color of SVG converted properly into Canvas
- how to properly install dc.js for using with Rails 5?
- include d3.js into angular2 project
- Graph won't reload properly into D3 force layout
- Install D3 on Meteor Angular2
- How can I properly aggregate / group multiple line graphs into one overall graph with d3.js when the x-values aren't matching exactly?
- D3 chart inside a div in angular2 applicaiton not rendering properly
- Is there a way to zoom into a D3 force layout graph?
- d3.js Map (<svg>) Auto Fit into Parent Container and Resize with Window
- Packing different sized circles into rectangle - d3.js
- How to properly add and use D3 Events?
- Is there a way to convert CSV columns into hierarchical relationships?
- d3.js graphs output into high resolution print quality files?
- d3.js - mouseover event not working properly on svg group
- d3js: make new parent data descend into child nodes
- Properly display bin width in barChart using dc.js and crossfilter.js
- SVG not rendering properly as a backbone view
- d3: How to properly chain transitions on different selections
- How to convert a jQuery object into a d3 object?
- Correct Way to Import D3.js into an Angular 2 Application
- proper way to configure d3 to work with angular2 and typescript
- Fit Text into SVG Element (Using D3/JS)
- Having trouble integrating D3.js (collapsible tree) into Angular application
- importing d3.event into a custom build using rollup
- What object type is the instance element parameter pass into the link function of an angular directive?
- Can I run a component method only in the client using Angular2 Universal?
- How to change a circle into a square with d3.js
- D3: use nest function to turn flat data with parent key into a hierarchy
More Query from same tag
- D3.js JSON parse error
- d3.js using d3.scale.sqrt()
- Differing values for d3.scale.pow(0.5) versus d3.scale.sqrt()
- d3 with multiple charts reading separate files in two different divs
- D3.js: draw simple, updatable line graph?
- d3js map displays incorrectly in mobile chrome
- D3.js linking node items is not working as expected
- d3 bar chart grow from height 0 to bars at loading
- Apply force to entering nodes only in d3.js
- Basic D3 - Working with arrays inside objects
- Mapping a relative path import to the right `@types` in Typescript
- Why do the d3 time range functions normalize values when using step?
- event.pageX is working in Chrome but not working in Firefox
- How can I remove a line from the 110m TopoJson world map?
- D3.js Donut Chart change node colors and add text label to middle
- Rescale an SVG in CSS
- d3.js - Adding axis labels to hive plot
- Cannot rotate text d3js
- jsonLD to graphical representationnot working
- C3 js grouped bar chart scolling and fixing y axis issue
- Why is d3.arc() giving me the function instead of the path string?
- Y axis ticks with wrong rotation
- D3.js Giving a legend to a donut chart with inner rings
- Draw line chart on top of area chart
- D3: Multiple force layouts in one SVG?
- How to use d3.drag()?
- D3 Sunburst diagram depth
- Getting unexpected black background after applying style:"stroke: blue; stroke-width: 2px;"
- getBBox of selection with D3 v4
- D3: Zooming/Panning Line Graph in SVG is not working in Canvas