我想创建一个日历视图,如下例所示:http ://bl.ocks.org/4063318 :

其实我正在尝试修改它。
我有一个像这样的关联数组:#AdminCourt[["2012-10-02", 2], ["2012-10-09", 2], ["2012-10-16", 1]] #ConstituentAssembly[["2012-10-02", 2], ["2012-10-09", 2], ["2012-10-12", 2], ["2012-10-16", 2]]
我尝试像这样填写日历:
BigWordsDates2.map(function(d) {
return {
date: d[0],
close: d[1]
};
var data = d3.nest()
.key(function(d) { return d.Date; })
.rollup(function(d) { return (d.Close - 0); });
rect.filter(function(d) { return d in data; })
.attr("class", function(d) { return "day " + color(data[d]); })
.select("title")
.text(function(d) { return d + ": " + percent(data[d]); });
});
Run Code Online (Sandbox Code Playgroud)
我知道我没有循环遍历数组,我不知道我如何尝试每个数组,但似乎我没有正确理解它。
以下是我需要你帮助的事情:)