0
如何爲我在d3.js中創建的圖形設置此樣本數據的格式?D3的格式數據
[
[
[
"2",
"2013-01-02 00:00:00+00"
],
[
"3",
"2012-12-28 00:00:00+00"
],
[
"3",
"2012-12-27 00:00:00+00"
],
[
"1",
"2012-12-26 00:00:00+00"
],
[
"1",
"2012-12-24 00:00:00+00"
],
[
"4",
"2012-12-21 00:00:00+00"
],
[
"1",
"2012-12-20 00:00:00+00"
]
],
[
[
"1",
"2012-12-27 00:00:00+00"
],
[
"2",
"2012-12-21 00:00:00+00"
],
[
"2",
"2012-12-18 00:00:00+00"
],
[
"1",
"2012-12-17 00:00:00+00"
],
[
"1",
"2012-11-27 00:00:00+00"
],
[
"1",
"2012-11-03 00:00:00+00"
],
[
"1",
"2012-10-27 00:00:00+00"
]
]
]
目前,我的JavaScript控制檯給我d3.v3.js內Uncaught TypeError: Cannot use 'in' operator to search for '_dateElement' in NaN
:1033當D3試圖解析這個數據
似乎D3並不想對付引號中的數字,沒有引號會導致無效的json,而我的ajax調用將不會返回,這意味着我將無法解析我的d3函數中的數組。
我相信d3可以解析和格式化json,但我處於僵局。如何格式化這些數據,日期對象是我的X軸的升序,Y軸是整數值的最大值
你能簡單的通過'parseInt函數()'通過INT字符串? –