我从微控制器获取传感器数据,将其发送到mysql数据库,并使用d3.json("tempdata.php",
我意识到mysql没有良好的数组支持,并且一次发送一个值是没有价值的......所以我有想法在一个已知的时间段内获取许多值,并将它们作为单个字符串发送。所述字符串是'accelX'字符串。我完全不知道如何解析如何解析accelX数据的子数组...
我想解析这些值,以便每次连续迭代accelX都可以更新图形。 'id'只是一个自动更新的索引。所有这三个块都来自单个传感器。 'id 1'是前30个值,'id 2'是31 - 61,'id 3'32-62。如果我能弄明白如何将它们分开,我想我会明白的。
这是“tempdata.php”返回的一小部分:
[{"id":"1","date":"2015-01-02 22:33:20","temp":"16.7","accelX":"0.047,0.016,0.031,0.031,0.016,0.031,0.078,0.063,0.047,0.031,0.000,0.031,0.000,0.031,0.031,0.063,0.031,0.000,0.047,0.031,0.000,0.016,0.031,0.031,0.047,0.063,0.000,0.016,0.031,0.031,"},{"id":"2","date":"2015-01-02 22:33:28","temp":"16.7","accelX":"0.656,0.688,0.656,0.656,0.625,0.594,0.625,0.672,0.688,0.703,0.734,0.734,0.719,0.703,0.703,0.656,0.672,0.688,0.672,0.641,0.656,0.703,0.734,0.734,0.813,0.813,0.844,0.828,0.781,0.766,"},{"id":"3","date":"2015-01-02 22:33:34","temp":"16.8","accelX":"0.563,0.578,0.563,0.578,0.594,0.609,0.672,0.688,0.719,0.734,0.719,0.750,0.750,0.734,0.781,0.781,0.766,0.750,0.719,0.703,0.734,0.766,0.750,0.781,0.781,0.750,0.703,0.734,0.734,0.734,"}]