コード例 #1
0
<?php

include 'gnuplot.php';
$p = new GNUplot();
foreach ($_GET as $dat => $dummy) {
    $data = PGData::createFromFile($dat, $dat);
    $p->plotData($data, 'points', '1:2');
}
$p->exe("set key left \n");
$p->export('graph.png');
$p->close();
?>

<img src='graph.png' \>

コード例 #2
0
        //    echo $query."\n";
        $timeSpan = $endDate->format("U") - $startDate->format("U");
        //    echo "timeSpan = ".$timeSpan."\n";
    } else {
        $query = "SELECT * FROM device WHERE ipaddress='" . $ip_address . "'";
    }
}
//  echo $query."\n";
$result = mysqli_query($link, $query);
$rowCnt = mysqli_num_rows($result);
// set line colors
$pTemp->set("style line 1 linewidth 2 linecolor rgb \"#000\"");
$pTemp->set("style line 2 linecolor rgb \"red\"");
$pTemp->set("style line 3 linecolor rgb \"blue\"");
// assign line values
$tempData = new PGData('Temperature');
$oldTime = NULL;
while ($obj = mysqli_fetch_object($result)) {
    if ($hotTest === "") {
        $hotTest = $obj->{$tempType};
    } else {
        if ($obj->{$tempType} > $hotTest) {
            $hotTest = $obj->{$tempType};
        }
    }
    if ($coldTest === "") {
        $coldTest = $obj->{$tempType};
    } else {
        if ($obj->{$tempType} < $coldTest) {
            $coldTest = $obj->{$tempType};
        }