0
我試着輸入從我的數組字符串中獲取的文件中的retreiving數據。但它只讀取第一個值。 這是我如何retreiving數據集;pChart輸入數組
$file = explode(" ", file_get_contents("data/data-02"));
foreach ($file as $content)
{
$result[] = array_filter(array_map("trim", explode(" ", $content)));
}
//var_dump($result);
//echo $result[0][1];
$time = '';
for ($id = 1; $id < 20; $id+= 6)
{
$time .= '"'.$result[0][$id].'"'.',';
}
$sugar_1 = '';
for ($id = 2; $id <20; $id+=6)
{
$sugar_1 .= $result[0][$id].',';
}
$sugar_2 = '';
for ($id = 5; $id <20; $id+=6)
{
$sugar_2 .= $result[0][$id].',';
}
ex。回波sugar_1是
58,60,62,48,58,60,62,48,58,62,48,58,60,62,48,58,60,62,48,58,60 ,62,48,58,60,62,48,58,60,62,48,58,60,
,現在我想輸入到這個
/* pChart library inclusions */
include("pChart/class/pData.class.php");
include("pChart/class/pDraw.class.php");
include("pChart/class/pImage.class.php");
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array($sugar_1),"Probe 1");
$MyData->addPoints(array($sugar_2),"Probe 2");
$MyData->setSerieTicks("Probe 2",4);
$MyData->setAxisName(0,"Sugar level in blood");
$MyData->addPoints(array($time),"Labels");
$MyData->setSerieDescription("Labels","Hours");
$MyData->setAbscissa("Labels");
但作爲我說,它只讀取第一個值,但是例如,如果我要在那裏添加smth,如
$MyData->addPoints(array($sugar_1**,44,66**),"Probe 1");
那麼這些增加的值es完美運作。我沒有了我的類型來弄清楚。