私のAPIは、次のJSON構造で呼び出しに応答します。
[
{
"order": {
"total": "240.0",
"completed_at": 1358432545000
}
},
{
"order": {
"total": "720.0",
"completed_at": 1359474090000
}
}
]
ただし、Flot Graphsでデータを使用するには、このJSONを次のように構造化する必要があります。
{
"label":"Order",
"dataBar":[
[
1358432545000,
240.0
],
[
1325635200000 ,
720.0
]
]
}
次のコードを試しましたが、すべてのデータがカンマで区切られ、「[」と「]」が返されません。
var flotData = $.map(API_Response, function(i){ return [i.order.completed_at, parseInt(i.order.total)] });
どうすればいいですか?