gpt4 book ai didi

javascript - d3.js 甘特图

转载 作者:行者123 更新时间:2023-11-30 11:57:26 27 4
gpt4 key购买 nike

var tasks;   
d3.json("http://localhost:8080/result", function(error, data) {
tasks = data
data.forEach(function(d) {
d.startDate = new Date(d.maxTime["$date"]);
d.endDate = new Date(d.minTime["$date"]);
});

var taskNames = ["Bob", "Sam"];

var gantt = d3.gantt().taskTypes(taskNames);
gantt(data);
});

我正在使用来自 here 的帮助这是我的 json 对象数组从 http://localhost:8080/result 返回的内容看起来像:

[
{"minTime": {"$date": 1459555200000},
"maxTime": {"$date": 1459555860000},
"Time": 660.0, "Name": "Sam"},
{"minTime": {"$date": 1459558800000},
"maxTime": {"$date": 1459563265000},
"Time": 4465.0, "Name": "Bob"},
{"minTime": {"$date": 1459562400000},
"maxTime": {"$date": 1459563842000},
"Time": 1442.0, "Name": "Sam"},
...
]

我遇到了一个错误

A negative value is not valid. ("-30.00296 864734321")

和其他 397 个。

这些错误是什么意思?

最佳答案

尝试

d.startDate = new Date(d.maxTime.$date);   
d.endDate = new Date(d.minTime.$date);

d.startDate = new Date(d.maxTime["$date"]);   
d.endDate = new Date(d.minTime["$date"]);

关于javascript - d3.js 甘特图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37526981/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com