如何为我在 d3.js 中制作的图表格式化此示例数据?
[
[
[
"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"
]
]
]
Uncaught TypeError: Cannot use 'in' operator to search for '_dateElement' in NaN
目前,当 d3 尝试解析此数据时,我的 javascript 控制台在 d3.v3.js:1033 内为我提供
似乎d3不想处理引号中的数字,没有引号会使json无效,我的ajax调用不会返回,这意味着我将无法解析我的d3函数中的数组。
我相信 d3 可以解析和格式化 json,但我陷入了僵局。我如何格式化这些数据,日期对象将是我的 X 轴以升序排列,Y 轴将是整数值的最大值