我有數據。比方說:檢查D3中所有數據點之間的所有值
date,comments
19-Apr-2016,Today was great.
21-Apr-2016,Today was not so great.
1-May-2016,Interesting things happened!
(所有時間被解析爲當然的日期)
我想通過從2016年4月19日,每天2016年5月1日,讓一個元素爲每天,然後在存在相關數據的地方注入數據。例如:
19-Apr-2016 - Today was great.
20-Apr-2016 - <No entry>
21-Apr-2016 - Today was not so great.
22-Apr-2016 - <No entry>
...
1-May-2016 - Interesting things happened!
這是當前的代碼。它的前和每一個數據點創建了一個元素:
preview.selectAll("svg")
.append("g")
.data(sums)
.enter()
.append("rect")
// Drawing code etc. Setting height, class, color, w/e
我如何遍歷所有天,無論是否有他們的數據?
有點需要向我們展示更多的代碼,最好是您的數據... – thatOneGuy