Can't build my path. Attribute d is wrong type

815 views
Skip to first unread message

damie...@gmail.com

unread,
Feb 15, 2017, 5:24:58 AM2/15/17
to d3-js
Hi everyone,

I'm trying to create a raceProfile using D3.js. This raceProfile is a diagram showing altitude depending to the race distance. When I try to create my svg, i'm getting this error:


Error: <path> attribute d: Expected number, "M0,NaNL14.354838709…".
(anonymous) @   d3.min.js:3
oy          @   d3.min.js:6
uy          @   d3.min.js:6
(anonymous) @   profile3.html:131
(anonymous) @   d3.min.js:6
call        @   d3.min.js:6
e           @   d3.min.js:6 


Here is the code i'm using to create my RaceProfile. In the error, the line 131 is:

var areaPath = self.svg.append('svg:path').datum(data).attr("class", "area").attr("d", self.area).node();


And, I have the error returned because of :attr("d", self.area)


You should have all my ressources, but, don't hesitate if you need further informations.


As a student, if you have any ressources to share, i accept everything.



Best Regards, Damien.

Message has been deleted

steve rickus

unread,
Feb 15, 2017, 3:02:06 PM2/15/17
to d3-js
So it appears that self.area is supposed to be a string that contains the path definition, right? In the error shown below, the first coordinate has NaN as the y coordinate, which is probably why you are getting the error.

I would check the code that builds the value of the self.area string (or the data feeding it).
--
Steve
Reply all
Reply to author
Forward
0 new messages