在PHP中为多个数据集flot

时间:2013-02-13 06:36:20

标签: php json flot

我的数据为:

  

$ data1 = array([1341354816000,1],[1341358185000,2],[   1341361620000,3],[1341538421000,4],[1341621724000,5],[   1341868470000,6],[1342133445000,7],[1342645937000,8],[   1342651985000,9],[1342744374000,10],[1343151552000,11],[   1343285910000,12],[1343286178000,13],[1343288137000,14],[   1343307010000,15],[1343307401000,16],[1343625187000,17],[   1343648616000,18],[1343649176000,19],[1343649567000,20],[   1343649898000,21],[1343867245000,22],[1343938551000,23],[   1343938916000,24],[1343939382000,25],[1344041570000,26],[   1344051059000,27],[1344235565000,28],[1344236000000,29],[   1344248074000,30 []];


  

$ data2 = array([1341354816000,1],[1341358185000,2],[   1341361620000,3],[1342133445000,4],[1342645937000,5],[   1342651985000,6],[1342744374000,7],[1343286178000,8],[   1343288137000,9],[1343307010000,10],[1343307401000,11],[   1343625187000,12],[1343867245000,13],[1343938551000,14],[   1343938916000,15],[1343939382000,16],[1344041570000,17],[   1344051059000,18],[1344248074000,19],[1344322547000,20],[   1344330089000,21],[1344360922000,22],[1344405113000,23],[   1344445006000,24],[1344447855000,25],[1344479054000,26]);


  

$ data3 = array([1341354816000,1],[1341358185000,2],[   1341361620000,3],[1341538421000,4],[1341621724000,5],[   1342133445000,6],[1342645937000,7],[1342651985000,8],[   1342744374000,9],[1343286178000,10],[1343288137000,11],[   1343307010000,12],[1343307401000,13],[1343625187000,14],[   1343867245000,15],[1343938551000,16],[1343938916000,17],[   1343939382000,18]);

现在我必须将这些数据绘制到绘图中,与转动系列ON / OFF示例相同。

任何人都可以在php中为这段代码提供帮助。

我已经从不同的sql表和php创建了这个列表,所以如果php中的延续代码那么它会有所帮助。

我曾尝试将这些数据添加到数据集中:

var datasets = { "all": { label: "All", data : '$data1' }, "resolved": { label: "Resolved", data : '$data2' }, "closed": { label: "Closed", data : '$data3' } };

无效

1 个答案:

答案 0 :(得分:0)

添加数据,绘图和打开/关闭的示例 - http://jsfiddle.net/zxtFc/3/

var DataSet1 = [ 
[1341354816000, 1], [ 1341358185000, 2] , [ 1341361620000, 3] , [ 1341538421000, 4] , [    1341621724000, 5] , [ 1341868470000, 6] , [ 1342133445000, 7] , [ 1342645937000, 8] , [ 1342651985000, 9] , [ 1342744374000, 10] , [ 1343151552000, 11] , [ 1343285910000, 12] , [ 1343286178000, 13] , [ 1343288137000, 14] , [ 1343307010000, 15] , [ 1343307401000, 16] , [ 1343625187000, 17] , [ 1343648616000, 18] , [ 1343649176000, 19] , [ 1343649567000, 20] , [ 1343649898000, 21] , [ 1343867245000, 22] , [ 1343938551000, 23] , [ 1343938916000, 24] , [ 1343939382000, 25] , [ 1344041570000, 26] , [ 1344051059000, 27] , [ 1344235565000, 28] , [ 1344236000000, 29] , [ 1344248074000, 30]
];