本文整理汇总了PHP中graph函数的典型用法代码示例。如果您正苦于以下问题:PHP graph函数的具体用法?PHP graph怎么用?PHP graph使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了graph函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
</td>
</tr>
</table>
<? //pr($rpp);?>
<table class="noborder">
<tr>
<th class="title" style="width:30%;">Nama</th>
<th style="width:10%;">Jumlah</th>
<th style="width:10%;">Lihat</th>
<th>Chart</th>
</tr>
<? foreach($guru as $dataguru){?>
<tr>
<td class="title"><?php
echo $dataguru['nama'];
?>
</td>
<td style="text-align:center;" class="title"><?php
echo count($rpp[$dataguru['id_peg']]);
?>
POST</td>
<td style="text-align:center;" class="title"><a class="modal" href="<?php
echo base_url('akademik/kepsek/lihat/' . $_POST['jenis'] . '/' . $this->myencrypt->encode(serialize($dataguru)) . '');
?>
">Lihat</a></td>
<td>
<? graph(count($rpp[$dataguru['id_peg']]),$totrpp);?>
</td>
</tr>
<? } ?>
</table>
示例2: countrange
$days = 31;
$color = "green";
break;
case "11":
$days = 30;
$color = "blue";
break;
case "12":
$days = 31;
$color = "magenta";
break;
}
print " <td><div style=\"background: {$color}; height: {$record[count]}; width: {$colwidth};\"></div>{$label}</td>\n";
}
print " <td valign=top>{$max}</td>\n";
print " </tr>\n";
print "</table>";
}
#Count pedalpalooza events
countrange("2009-06-11", "2009-06-27");
#Count 2009 events
countrange("2009-01-01", "2009-12-31");
?>
<div class="content">
<h1>Event counts</h1>
<?php
graph("2009-06-11", "2009-06-27");
?>
</div>
<?php
include INCLUDES . "/footer.html";
示例3: array
$showRepeats = true;
} else {
$showRepeats = false;
}
$options = array();
$options['showLegend'] = $showLegend;
$options['showMargin'] = $showMargin;
$options['showNegatives'] = $showNegatives;
$options['showBands'] = $showBands;
$options['showMarks'] = $showMarks;
$options['showAll'] = $showAll;
$options['units'] = $units;
$d = $driver->listEvents($sensor, $times['startTime'], $times['endTime'], $showRepeats, !isOptionOn($options, 'showAll'), $units);
$stop_watch['Done list Events'] = microtime();
//echo "events starting at ". $times['startTime']. " ending at ".$times['endTime'];
graph($d, $l, $times, $options);
$stop_watch['Done Graph'] = microtime();
//Utils::echo_stopwatch();
/** Functions **/
/***************/
/**
* @param data - the return of listEvents
* @param list - the return of listSensors
* @param times - the return of getDisplayDataTimes
* @param options - array of various graph options/params
*/
function graph($data, $list, $times, $options = array())
{
global $colors;
//for defaults if not set
global $conf;
示例4: template_edit
function template_edit() {
/* ================= input validation ================= */
input_validate_input_number(get_request_var("id"));
/* ==================================================== */
display_output_messages();
$graph_template_tabs = array(
"general" => __("General"),
"items" => __("Items"),
"graphs" => __("Graphs"),
);
if (!empty($_REQUEST["id"])) {
$graph_template = db_fetch_row("select * from graph_templates where id=" . $_REQUEST["id"]);
$header_label = __("[edit: ") . $graph_template["name"] . "]";
}else{
$graph_template = array();
$header_label = __("[new]");
#$_REQUEST["id"] = 0;
}
/* set the default settings category */
if (!isset($_REQUEST["tab"])) {
/* there is no selected tab; select the first one */
$current_tab = array_keys($graph_template_tabs);
$current_tab = $current_tab[0];
}else{
$current_tab = $_REQUEST["tab"];
}
/* draw the categories tabs on the top of the page */
print "<table width='100%' cellspacing='0' cellpadding='0' align='center'><tr>";
print "<td><div class='tabs'>";
if (sizeof($graph_template_tabs) > 0) {
foreach (array_keys($graph_template_tabs) as $tab_short_name) {
print "<div class='tabDefault'><a " . (($tab_short_name == $current_tab) ? "class='tabSelected'" : "class='tabDefault'") . " href='" . htmlspecialchars("graph_templates.php?action=template_edit" . (isset($_REQUEST['id']) ? "&id=" . $_REQUEST['id'] . "&template_id=" . $_REQUEST['id']: "") . "&filter=&device_id=-1&tab=$tab_short_name") . "'>$graph_template_tabs[$tab_short_name]</a></div>";
if (!isset($_REQUEST["id"])) break;
}
}
print "</div></td></tr></table>";
if (!isset($_REQUEST["tab"])) {
$_REQUEST["tab"] = "general";
}
switch (get_request_var_request("tab")) {
case "graphs":
include_once(CACTI_BASE_PATH . "/lib/graph/graphs_form.php");
include_once(CACTI_BASE_PATH . "/lib/utility.php");
include_once(CACTI_BASE_PATH . "/lib/api_graph.php");
include_once(CACTI_BASE_PATH . "/lib/api_tree.php");
include_once(CACTI_BASE_PATH . "/lib/api_data_source.php");
include_once(CACTI_BASE_PATH . "/lib/template.php");
include_once(CACTI_BASE_PATH . "/lib/html_tree.php");
include_once(CACTI_BASE_PATH . "/lib/html_form_template.php");
include_once(CACTI_BASE_PATH . "/lib/rrd.php");
include_once(CACTI_BASE_PATH . "/lib/data_query.php");
graph();
break;
case "items":
/* graph item list goes here */
if (!empty($_REQUEST["id"])) {
graph_template_display_items();
}
break;
default:
graph_template_display_general($graph_template, $header_label);
break;
}
}
示例5: templates
if(!Privileges_members_ownstats()){
$tpl=new templates();
echo "alert('".$tpl->javascript_parse_text("{ERROR_NO_PRIVS}")."');";
exit;
}
}else{
$user=new usersMenus();
if(!$user->AsWebStatisticsAdministrator){
$tpl=new templates();
echo "alert('".$tpl->javascript_parse_text("{ERROR_NO_PRIVS}")."');";
exit;
}
}
if(isset($_GET["popup"])){popup();exit;}
if(isset($_GET["graph"])){echo graph();exit;}
if(isset($_GET["browsed"])){echo browsed_websites();exit;}
if(isset($_GET["browsed-popup"])){echo browsed_websites_popup();exit;}
if(isset($_GET["queries"])){queries();exit;}
if(isset($_GET["last-events"])){last_events();exit;}
if(isset($_GET["query-menu"])){query_menu();exit;}
if(isset($_GET["popup-filter"])){popup_filter();exit;}
if(isset($_GET["Q_CLIENT"])){saveFilter();exit;}
if(isset($_GET["show-hits"])){showhits();exit;}
js();
function thumbnail_zoom_js(){
$page=CurrentPageName();
示例6: header
$err = $_GET['err'];
if ($err) {
$file = $err_graph_file;
}
header("Content-type: image/png");
header("Content-length: " . filesize($file));
print file_get_contents($file);
exit;
}
if (file_exists($graph_file)) {
unlink($graph_file);
}
if (file_exists($err_graph_file)) {
unlink($err_graph_file);
}
graph($seconds, $graph_file);
graph_err($seconds, $err_graph_file);
$dc = $_GET['_dc'];
print <<<EOF
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
\t<head>
\t\t<title>Last {$time}</title>
\t</head>
\t<body>
\t\t<img src="data/stats.php?img=1&time={$time}&_dc={$dc}" /><br />
\t\t<img src="data/stats.php?img=1&err=1&time={$time}&_dc={$dc}" />
\t</body>
</html>
EOF
;
示例7: graphMarkup
public function graphMarkup($graphData, $options)
{
$output = "<p><a class='showModal' href='#' target-modal='" . $options['main_id'] . "'>" . $options['link'] . "</a></p>";
$output .= "<div id='" . $options['main_id'] . "' class='graphsContainer modal'>";
$output .= "<h2>" . $options['main_title'] . "</h2>";
$output .= "<p><a href='#' class='printGraph'>Print</a></p>";
foreach ($graphData as $hItem) {
$graph_heading = $hItem[$options['graph_heading']];
$bars = array();
if ($hItem['barsData']) {
foreach ($hItem['barsData'] as $key => $barItem) {
$bar = array("bar_title" => "", "bar_max" => "", "bar_val" => "");
foreach ($bar as $key => $value) {
if (is_array($options[$key]) && isset($options[$key]['func'])) {
// build params
foreach ($options[$key]['params'] as $k => $v) {
$params = array();
$params[] = $barItem[$v];
}
$bar[$key] = call_user_func_array($options[$key]['func'], $params);
} else {
$bar[$key] = $barItem[$options[$key]];
}
}
$bars[] = $bar;
}
// pr($bars);
$output .= graph($graph_heading, $bars);
}
}
$output .= "</div>";
// graphsContainer
// $output .= "</div>"; // modalBkg
return $output;
}
示例8: countrange
$days = 31;
$color = "green";
break;
case "11":
$days = 30;
$color = "blue";
break;
case "12":
$days = 31;
$color = "magenta";
break;
}
print " <td><div style=\"background: {$color}; height: {$record[count]}; width: {$colwidth};\"></div>{$label}</td>\n";
}
print " <td valign=top>{$max}</td>\n";
print " </tr>\n";
print "</table>";
}
#Count pedalpalooza events
countrange("2008-06-12", "2008-06-28");
#Count 2008 events
countrange("2008-01-01", "2008-12-31");
?>
<div class="content">
<h1>Event counts</h1>
<?php
graph("2008-06-12", "2008-06-28");
?>
</div>
<?php
include INCLUDES . "/footer.html";
示例9: foreach
foreach($aMonth as $iMonth){
echo '<option ' . ($iMonth == $iSelectedMonth ? 'selected="selected" ' : '') . 'value="' . $iMonth . '">' . date('F', mktime(0, 0, 0, $iMonth, 1, date('Y'))) . '</option>';
}
?>
</select>
<input type="submit" id="submit" value="Submit">
<a href="./">Log out</a>
</form>
<h2>Visitors:</h2>
<?php graph($oAnalytics->getVisitors()); ?>
<h2>Pageviews:</h2>
<?php graph($oAnalytics->getPageviews()); ?>
<h2>Visits per Hour:</h2>
<?php graph($oAnalytics->getVisitsPerHour()); ?>
<h2>Browsers:</h2>
<?php graph($oAnalytics->getBrowsers()); ?>
<h2>Referrers:</h2>
<?php graph($oAnalytics->getReferrers()); ?>
<h2>Search words:</h2>
<?php graph($oAnalytics->getSearchWords()); ?>
<h2>Screen resolution:</h2>
<?php graph($oAnalytics->getScreenResolution()); ?>
</body>
</html>
示例10: syslogs
function syslogs()
{
if ($_GET["lines"] == null) {
$_GET["lines"] = 50;
}
$users->syslogng_installed = false;
$users = new usersMenus();
if (!$users->syslogng_installed) {
if ($users->EnableMysqlFeatures == 0) {
echo graph();
exit;
}
}
$q = new syslogs();
$q->BuildNecessaryTables();
$q->q_daemons = $_GET["q_daemons"];
$q->limit_end = $_GET["q_lines"];
$q->q_search = $_GET["q_search"];
$daemon = Field_array_Hash($q->GetDaemons(), 'q_daemons', $_GET["q_daemons"], 'sysevents_query()');
$form = "<table style=\"width:100%\">\n\t<tr>\n\t<td align='right'><strong>Daemon:</strong></td>\n\t<td>{$daemon}</td>\n\t<td align='right'><strong>{search}:</strong></td>\n\t<td>" . Field_text('q_search', $_GET["q_search"], 'width:150px', null, 'sysevents_query()') . "</td>\t\n\t<td align='right'><strong>{lines_number}:</strong></td>\n\t<td>" . Field_text('q_lines', $_GET["q_lines"], 'width:40px', null, 'sysevents_query()') . "</td>\n\t<td>" . imgtootltip('icon_refresh-20.gif', '{refresh}', 'sysevents_query()') . "</td>\n\t\t\n\t</tr>\n\t</table>";
$form = "<br>" . RoundedLightGrey($form);
$html = "\n\t<input type='hidden' id='switch' value='{$_GET["main"]}'>\n\t\n\t\n\t<table style=\"width:100%\">\n\t\n\t";
$tpl = new templates();
$r = $q->build_query();
$count = 0;
$style = "style='border-bottom:1px dotted #CCCCCC'";
while ($ligne = @mysql_fetch_array($r, MYSQL_ASSOC)) {
$ligne["msg"] = htmlentities($ligne["msg"]);
$html = $html . "<tr " . CellRollOver_jaune() . ">\n\t\t<td width=1% valign='top' {$style}><img src='img/fw_bold.gif'></td>\n\t\t<td width=1% nowrap valign='top' {$style}>{$ligne["date"]}</td>\n\t\t<td {$style}>{$ligne["msg"]}</td>\n\t\t<td width=1% nowrap valign='top' {$style}>{$ligne["program"]}</td>\n\t\t</tr>";
$count = $count + 1;
if ($count > 500) {
$error = "\n\t\t\t<tr>\n\t\t\t\t<td width=1% valign='top' styme='border-bottom:1px dotted red'><img src='img/fw_bold.gif'></td>\n\t\t\t\t<td colspan=3 style='color:red;font-weight:bold;border-bottom:1px dotted red'>{too_many_lines_exceed}:500</td>\n\t\t\t</tr>";
$html = $tpl->_ENGINE_parse_body($error) . $html;
break;
}
}
$html = $html . "</table>";
$html = $tpl->_ENGINE_parse_body($form) . "<br>{$html}";
echo $html;
}
示例11: graph
</SELECT>
</FORM>
<?php
if (JPG_MAIN == "NOTWORKING YET") {
// Set up Graph variables
$slice = 0;
$host = "";
$date = "yesterday";
$date2 = "today";
$str = $str;
$limit = 10;
// Equals top 10 percent of hosts
$type = "pie3d";
$mapName = 'Top10';
$fileName = IMG_CACHE_DIR . "Top10.png";
$imgMap = graph($slice, $host, $date, $date2, $str, $limit, $type, $mapName, $fileName);
echo "{$imgMap} <img src=\"{$fileName}\" alt=\"graph\" ismap usemap=\"#{$mapName}\" border=\"0\">";
}
}
}
/* BEGIN: Added by BPK to automatically repopulate the search form selections from $_SESSION using JavaScript */
// Note: we use javascript so the Reset button will still work.
echo "<script type=\"text/javascript\" language=\"javascript\">\n";
// begin table restore
if (isset($_SESSION['table'])) {
$table = $_SESSION['table'];
}
if (!empty($table)) {
?>
select = document.getElementById('table');
示例12: graph
<?php
function graph($tabwidth, $tabheight, $altura, $altura2)
{
return "\n\t\t\n\t\t<table width={$tabwidth} height={$tabheight} border=1>\n\t\t\t<tr valign=bottom>\n\t\t\t<td class='line'><img src=./png/blue.png border=1 width=30 height={$altura}> <img src=./png/red.png border=1 width=30 height={$altura2}></td>\n\t\n\t\t</table>\n\t\t\n\t\t";
}
print graph(200, 400, 70, 140);
示例13: countrange
break;
case "10":
$days = 31;
$color = "green";
break;
case "11":
$days = 30;
$color = "blue";
break;
case "12":
$days = 31;
$color = "magenta";
break;
}
print " <td><div title=\"{$record[count]} events by {$record[whendate]}\" style=\"background: {$color}; height: {$record[count]}; width: {$colwidth};\"></div>{$label}</td>\n";
}
print " <td valign=top>{$max}</td>\n";
print " </tr>\n";
print "</table>";
}
#Count pedalpalooza events
countrange(PPSTART, PPEND);
?>
<div class="content">
<h1>Event counts</h1>
<?php
graph(PPSTART, PPEND);
?>
</div>
<?php
include INCLUDES . "/footer.html";
示例14: drawData
}
function drawData($image, $w, $h, $col, $top, $right, $left, $bottom, $numX, $xValues, $max)
{
$graphHeight = $h - ($top + $bottom);
$pixelValue = $graphHeight / $max;
$graphWidth = $w - ($right + $left);
$spacing = $graphWidth / $numX;
$gap = $spacing / 4;
$x = $left + $spacing / 6;
for ($a = 0; $a < $numX; $a++) {
$rectSize = $graphHeight + $top - $xValues[$a] * $pixelValue;
ImageFilledRectangle($image, $x, $rectSize, $x + ($spacing - $gap), $h - $bottom, $col);
$x = $x + $spacing;
}
}
$xTitles = array("Mon", "Tue", "Wed", "Thu", "Fri");
$xValues = array(50, 55, 78, 87, 32);
graph("graphics/graph.jpeg", 200, 150, 14, 2, "Total Number of Sales", "Sales £", "Weekdays", 5, $xTitles, $xValues, 5);
?>
<img src='graphics/graph.jpeg'>
示例15: get_id_handler
public function get_id_handler()
{
$emp_no = $this->id;
$dbc = $this->connection;
$dbc->selectDB($this->config->get('TRANS_DB'));
$query = "";
$args = array();
if ($emp_no == "") {
$query = "select\n emp_no,\n " . $dbc->weekdiff($dbc->now(), 'proc_date') . " as week,\n year(proc_date) as year,\n SUM(Rings) / count(emp_no) as rings,\n " . $dbc->convert('SUM(items)', 'int') . " / count(emp_no) as items,\n COUNT(Rings) / count(emp_no) as Trans,\n SUM(CASE WHEN transinterval = 0 then 1 when transinterval > 600 then 600 else transinterval END) / count(emp_no) / 60 as minutes,\n SUM(Cancels) / count(emp_no) as cancels,\n MIN(proc_date)\n from CashPerformDay\n GROUP BY emp_no," . $dbc->weekdiff($dbc->now(), 'proc_date') . ",year(proc_date)\n ORDER BY year(proc_date) desc," . $dbc->weekdiff($dbc->now(), 'proc_date') . " asc";
} else {
$query = "select\n emp_no,\n " . $dbc->weekdiff($dbc->now(), 'proc_date') . " as week,\n year(proc_date) as year,\n SUM(Rings) as rings,\n " . $dbc->convert('SUM(items)', 'int') . " as items,\n COUNT(*) as TRANS,\n SUM(CASE WHEN transInterval = 0 THEN 1 when transInterval > 600 then 600 ELSE transInterval END)/60 as minutes,\n SUM(cancels)as cancels,\n MIN(proc_date)\n FROM CashPerformDay\n WHERE emp_no = ?\n GROUP BY emp_no," . $dbc->weekdiff($dbc->now(), 'proc_date') . ",year(proc_date)\n ORDER BY year(proc_date) desc," . $dbc->weekdiff($dbc->now(), 'proc_date') . " asc";
$args = array($emp_no);
}
if ($dbc->isView('CashPerformDay') && $dbc->tableExists('CashPerformDay_cache')) {
$query = str_replace('CashPerformDay', 'CashPerformDay_cache', $query);
}
$result = $dbc->exec_statement($query, $args);
$this->rpm = array();
// rings per minute
$this->ipm = array();
// items per minute
$this->tpm = array();
// transactions per minute
$this->cpr = array();
// cancels per rings
$this->cpi = array();
// cancels per items
$week = array();
// first day of the week
$i = 0;
/*
calculate rates
remove the time from the week
*/
while ($row = $dbc->fetch_array($result)) {
$temp = explode(" ", $row[8]);
$temp = explode("-", $temp[0]);
$week[$i] = $temp[0] . " " . $temp[1] . " " . $temp[2];
$minutes = $row[6];
// zeroes values where minutes = 0
if ($minutes == 0) {
$minutes = 999999999;
}
$this->rpm[$i] = $row[3] / $minutes;
$this->ipm[$i] = $row[4] / $minutes;
$this->tpm[$i] = $row[5] / $minutes;
if ($row[3] == 0) {
$this->cpr[$i] = 0;
} else {
$this->cpr[$i] = $row[7] / $row[3] * 100;
}
if ($row[4] == 0) {
$this->cpi[$i] = 0;
} else {
$this->cpi[$i] = $row[7] / $row[4] * 100;
}
$i++;
}
include_once 'graph.php';
/* clear out ony ld images */
$dh = opendir('image_area');
while (($file = readdir($dh)) !== false) {
if ($file[0] == '.') {
continue;
}
if (substr($file, -4) == '.png' && strstr($file, 'cash_report')) {
unlink('image_area/' . $file);
}
}
closedir($dh);
/* generate a reasonably unique session key */
$session_key = '';
for ($i = 0; $i < 20; $i++) {
$num = rand(97, 122);
$session_key = $session_key . chr($num);
}
/* write graphs in the image_area directory */
$session_key = "image_area/" . $session_key;
$width = graph($this->rpm, $week, $session_key . "cash_report_0.png");
graph($this->ipm, $week, $session_key . "cash_report_1.png", 10, 0, 0, 255);
graph($this->tpm, $week, $session_key . "cash_report_2.png", 60, 0, 255, 0);
graph($this->cpr, $week, $session_key . "cash_report_3.png", 90, 0, 0, 255);
graph($this->cpi, $week, $session_key . "cash_report_4.png", 90);
if (isset($_GET['pdf'])) {
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial', 'B', 16);
$str = "Rings per minute\n";
$str .= "(average: " . round($this->avg($this->rpm), 2) . ")";
$pdf->MultiCell(0, 11, $str, 0, 'C');
$pdf->Image($session_key . "cash_report_0.png", 65, 35, $width / 2);
$pdf->AddPage();
$str = "Items per minute\n";
$str .= "(average: " . round($this->avg($this->ipm), 2) . ")";
$pdf->MultiCell(0, 11, $str, 0, 'C');
$pdf->Image($session_key . "cash_report_1.png", 65, 35, $width / 2);
$pdf->AddPage();
$str = "Transactions per minute\n";
$str .= "(average: " . round($this->avg($this->tpm), 2) . ")";
$pdf->MultiCell(0, 11, $str, 0, 'C');
//.........这里部分代码省略.........