从多维数组中绘制Flot中的多个数据集

我希望有人可以帮助我解决我遇到的问题。

我正在使用Flot图和ruby on rails我没有问题设置两者中的任何一个,但我确实有一个问题,在一个图上绘制多个数据集。

我正在查询数据库并将结果返回到这样的数组中

[2015-2-01 12:00:00,50.4, 26.8,29.9,30.4] [2015-2-01 12:10:00,56.4, 26.3,29.9,70.4] 

在我得到ruby的结果后,我正在为每个结果创建一个数组数组,以便将列的标题放在一边,这样我得到这样的结果

 [[TIME:2015-2-01 12:00:00] [CPU:50][IO:40]] [[TIME:2015-2-01 12:15:00] [CPU:99][IO:40]] etc... 

我的问题是,一旦我将其返回到我在Rails中的视图,我想在Flot中绘制每个系列。 (与cpu的时间,与io的时间,与其他点的时间)

flot期望它的数据系列像[[time,value],[time,value]]。 因此,我需要弄清楚如何遍历我的多维数组并创建单独的数组,每个数组包含特定指标的时间和值。 非常感谢任何见解。 另外,据我所知,flot预期的时间值与我指定的时间值不同。

 thanks for the response. I can work on putting it in fiddle when I get home. Time is not the issue I know how to convert my time stamp to what flot is expecting. here is an example of the multi-dimensional array I'm receiving from my POST request array[ array[ 0: "BTIME, 2015-02-27 18:00" 1: "CPU, 50.0" 2: "IOWAIT, 38.0" 3: "CLWAIT, 0.0" 4: "APWAIT, 0.0" 5: "CCWAIT, 0.0" 6: "PLSEXEC, 1.0" 7: "JAVEXEC, 0.0] array[ 0: "BTIME, 2015-02-27 18:10" 1: "CPU, 44.0" 2: "IOWAIT, 35.0" 3: "CLWAIT, 0.0" 4: "APWAIT, 1.0" 5: "CCWAIT, 0.0" 6: "PLSEXEC, 1.0" 7: "JAVEXEC, 0.0"] 

]