n.getFullYear不是d3中的函数错误

时间:2016-03-15 07:54:39

标签: javascript d3.js

我有以下代码投掷 n.getFullYear不是函数错误, 任何想法?

var x = d3.time.scale().domain([d3.time.sunday(d3.min(items, function(d) { return d.start; })),
        d3.max(items, function(d) { return d.end; })])
        .range([0, width]);



 "items": [
      {
        "id": 0,
        "lane": 0,
        "start": "Mon Jan 16 2012 08:00:00 GMT+0545 (NPT)",
        "end": "Mon Jan 29 2012 08:00:00 GMT+0545 (NPT)",
        "class": "past",
        "desc": "This is a description."
      }
    ]

1 个答案:

答案 0 :(得分:1)

更改d.start和d.end以返回日期对象 d3.time.scale()。domain([d3.time.sunday(d3.min(items,function(d){return new Date(d.start);})),         d3.max(项目,功能(d){返回新日期(d.end);})])         .range([0,width]);