コード例 #1
0
<?php

// Graphs Package V2.1 16th March 2008
if (!file_exists("graphsconf.php")) {
    include "error_msg.php";
}
include "graphsconf.php";
if (!file_exists($jploc . "jpgraph.php")) {
    $string = "Unable to find JPGraph files";
    create_image1($string, $jploc);
    exit;
}
include $jploc . "jpgraph.php";
include $jploc . "jpgraph_line.php";
$clientraw = get_raw("{$hostloc}clientraw.txt");
// Create aray for y-axis
$y = array();
$y = array($clientraw['80'], $clientraw['81'], $clientraw['82'], $clientraw['83'], $clientraw['84'], $clientraw['85'], $clientraw['86'], $clientraw['87'], $clientraw['88'], $clientraw['89']);
$datay = $y;
if ($speed_conv != 1) {
    array_walk($datay, "KtoV");
}
//create timearray for the x-axis
$crhour = $clientraw[29];
$crmin = $clientraw[30];
$crhour = $crhour - 1;
if ($hourmode == "24") {
    if ($crhour == -1) {
        $crhour = 23;
    }
    $hr_pad = "0";
コード例 #2
0
function get_raw($rawfile)
{
    if (substr($rawfile, 0, 7) != "http://") {
        if (!file_exists($rawfile)) {
            $string = "Unable to find";
            create_image1($string, $rawfile);
            exit;
        }
    }
    $rawdata = array();
    $fd = fopen($rawfile, "r");
    if ($fd) {
        $rawcontents = '';
        while (!feof($fd)) {
            $rawcontents .= fread($fd, 8192);
        }
        fclose($fd);
        $delimiter = " ";
        $rawdata = explode($delimiter, $rawcontents);
    } else {
        $rawdata[0] = -9999;
    }
    return $rawdata;
}