I am trying to parse data from json data in D3.js, here is the problem function.
minDate = new Date(data[0][0]);
maxDate = new Date(data[274][0]);
var x = d3.scaleTime()
.domain([minDate, maxDate])
.range([0, width]);
Here is the error
Error: <rect> attribute x: Expected length, "NaN"
The CodePen link https://codepen.io/rocket18/pen/qpVeBj
Any help is greatly appreciated!
There were just some minor issues, you used d3.timeFormat
instead of d3.timeParse
, I added d.year = parseDate(d[0]);
in the data.forEach
and you appended an svg element to a svg element, I changed it to a div instead.
I also used d3.extent
in the .domain
Here's the full working code: Plunker
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments