小编Npn*_*ddy的帖子

d3.min.js:1未捕获的TypeError:n.getFullYear不是一个函数

我试图通过一次又一次地更改parseDate函数参数但仍然没有结果来解决此错误(“ d3.min.js:1 Uncaught TypeError:n.getFullYear不是一个函数”),当我通过d.date解析日期时forEach函数日期变为空,这就是为什么在svg路径中,其以“ NaN”作为输入,导致没有绘制多系列折线图的原因。

//JSON array called "somearray" is like this.Actual JSON Array is much bigger but just to show the problem i have given this much.
somearray = [{date: "2014-12-19 02:22:31",s0: 2,s1: 4,s2: 2},{date: "2015-05-03 12:10:32",s0: 5,s1: 5,s2: 1},{date: "2015-03-23 19:45:14",s0: 2,s1: 2,s2: 1},{date: "2015-06-02 22:58:35",s0:0,s1: 5,s2: 0}]
Run Code Online (Sandbox Code Playgroud)
<!DOCTYPE html>
<meta charset="utf-8">
<style> /* set the CSS */
body { 
  font: 12px 
  Arial;
}
path {
  stroke: steelblue;
  stroke-width: 2;
  fill: none;
}
.axis path,
.axis line { …
Run Code Online (Sandbox Code Playgroud)

javascript svg json d3.js

3
推荐指数
1
解决办法
3521
查看次数

标签 统计

d3.js ×1

javascript ×1

json ×1

svg ×1