Rakeysh Rakeysh - 1 year ago 311
AngularJS Question

Uncaught TypeError: Cannot read property 'arc' of undefined in AngularJS and D3

I am new to AngularJS and D3. I am building a dashboard using these technologies.
I have included the d3.min.js file in the index file and trying to draw a cirle with it.Here is the code:

enter code here
var svg = d3.select("body")
.attr("width", 200)
.attr("height", 200)
.attr("transform", "translate(100,100)");

var arc = d3.svg.arc()
.endAngle(2 * Math.PI);

.attr("class", "arc")
.attr("d", arc);

but I keep on getting a console message : Uncaught TypeError: Cannot read property 'arc'

I also tried to draw a barchart but this time the error reported was:
Uncaught TypeError: Cannot read property 'linear'

Please help

Answer Source

In D3 v4.x the syntax has changed from:




Here's a link to the changes in the new API: https://github.com/d3/d3/blob/master/CHANGES.md

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download