本文整理汇总了PHP中graph::add_bar方法的典型用法代码示例。如果您正苦于以下问题:PHP graph::add_bar方法的具体用法?PHP graph::add_bar怎么用?PHP graph::add_bar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graph
的用法示例。
在下文中一共展示了graph::add_bar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_day_information
private function show_day_information($type, $date)
{
$filter = new filter($this->db, $this->output, $this->user);
$filter->to_output($this->model->table, $this->model->hostnames);
if (($stats = $this->model->get_day_statistics($type, $date, $filter->hostname, $filter->webserver)) === false) {
$this->output->add_tag("result", "Database error.");
return false;
}
$graph = new graph($this->output);
$graph->title = $this->graphs[$type] . " for " . date("l j F Y", strtotime($date));
$graph->width = 960;
$graph->height = GRAPH_HEIGHT;
foreach ($stats as $hour => $count) {
$graph->add_bar("Hour " . $hour, $count, "hour");
}
$graph->to_output();
if (($stats = $this->model->get_day_information($type, $date, $filter->hostname, $filter->webserver)) === false) {
$this->output->add_tag("result", "Database error.");
return false;
}
$this->output->open_tag("day", array("hostnames" => show_boolean($this->model->hostnames), "label" => $this->graphs[$type]));
foreach ($stats as $stat) {
if ($type == "requests" || $type == "bytes_sent") {
$stat["count"] = $this->model->readable_number($stat["count"]);
}
$this->output->record($stat, "stat");
}
$this->output->close_tag();
}
示例2: execute
public function execute()
{
$graph = new graph($this->output);
$graph->title = "Demo graph";
$graph->width = 600;
$graph->height = 200;
$nr = 1;
for ($i = 0; $i < 6.3; $i += 0.1) {
$graph->add_bar("Bar number: " . $nr++, sprintf("%0.2f", sin($i) + 1.5));
}
$graph->to_output();
}