本文整理汇总了PHP中graph::graph方法的典型用法代码示例。如果您正苦于以下问题:PHP graph::graph方法的具体用法?PHP graph::graph怎么用?PHP graph::graph使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graph
的用法示例。
在下文中一共展示了graph::graph方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
$val_dif = $max_val - $min_val;
$yscale = 7;
for ($i = 4; $i <= 10; ++$i) {
// find a divisor
if ($val_dif % $i == 0) {
$yscale = $i;
break;
}
}
$graph->setProp('scale', 'date');
$graph->setProp('pointstyle', 7);
$graph->setColor('pointcolor', -1, 255, 0, 0);
$graph->setProp('startdate', (int) $min_time);
$graph->setProp('enddate', (int) $max_time);
$graph->setProp('xsclpts', 6);
$graph->setProp('xincpts', 6);
$graph->setProp('ysclpts', $yscale);
$graph->setProp('yincpts', $yscale);
if ($max_time - $min_time <= 365 * 24 * 60 * 60) {
$graph->setProp('dateformat', 1);
} elseif ($max_time - $min_time > 365 * 24 * 60 * 60) {
$graph->setProp('dateformat', 1);
}
$graph->setProp('showyear', true);
$graph->graph();
$graph->showGraph(_BASEPATH_ . '/tmp/admin/' . $type . $start_date . $end_date . '.png');
// $graph->showGraph();
}
}
redirect2page('tmp/admin/' . $type . $start_date . $end_date . '.png');
}
示例2: createGraph
function createGraph($data, $w = 400, $h = 200, $prop = "", $random = false)
{
global $numGraphs;
$numGraphs++;
$graph = new graph($w, $h);
if (is_array($prop)) {
$graph->storePropArr($prop);
} else {
$graph->setBulkProps($prop);
}
$data = explode(":", $data);
$dt = $data[1];
if (strtoupper($data[0]) == "XML") {
$graph->importXML($dt, isset($data[2]) ? $data[2] : "i", isset($data[3]) ? $data[3] : "d", isset($data[4]) ? $data[4] : "", isset($data[5]) ? $data[5] : 0);
} elseif (strtoupper($data[0]) == "CSV") {
$graph->importCSV($dt, isset($data[2]) ? $data[2] : "d,i", isset($data[3]) ? $data[3] : 0);
} elseif (strtoupper($data[0]) == "RAW") {
$graph->addBulkPoints($dt, ';');
} elseif (strtoupper($data[0]) == "FUN") {
$graph->graphFunction($dt, isset($data[2]) ? $data[2] : -1, isset($data[2]) ? $data[2] : 1);
} else {
$graph->error("Inline data format not understood. Read the readme.");
}
$graph->graph();
$name = $graph->getProp("tempfolder", "") . "graph" . substr(basename($_SERVER['PHP_SELF']), 0, 3) . $numGraphs . ($random == true ? rand(1, 100000) : "") . '.png';
$graph->showGraph($name);
if ($random && $graph->getProp("delold", true)) {
$fname = $graph->getProp("tempfolder", "") . "imagehistory" . basename($_SERVER['PHP_SELF']) . ".data";
$f = @file($fname);
if (count($f) > $graph->getProp("cachehistory", 5)) {
unlink($f[0]);
unset($f[0]);
}
$f[] = $name;
file_put_contents($fname, join(array_filter($f, $this->trimfilter), "\n"));
}
unset($graph);
return $name;
}