<?php
// ////////////////////////////////////////////////////////////////////////// //
// //
// This file is part of IPv6 Logger Script by //
// technikblog.gerhard-kerner.at //
// The scriptcode in this file based on maxChart.class //
// by http://www.phpf1.com //
// //
// Version 1.1, August 2012 //
// //
// (c) technikblog.gerhard-kerner.at //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
// //
// Dieses Programm ist Freie Software: Sie können es unter den Bedingungen //
// der GNU General Public License, wie von der Free Software Foundation, //
// Version 3 der Lizenz oder (nach Ihrer Option) jeder späteren //
// veröffentlichten Version, weiterverbreiten und/oder modifizieren. //
// //
// Dieses Programm wird in der Hoffnung, dass es nützlich sein wird, aber //
// OHNE JEDE GEWÄHRLEISTUNG, bereitgestellt; sogar ohne die implizite //
// Gewährleistung der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK. //
// Siehe die GNU General Public License für weitere Details. //
// //
// Sie sollten eine Kopie der GNU General Public License zusammen mit diesem //
// Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>. //
// //
// ////////////////////////////////////////////////////////////////////////// //
error_reporting(0);
class getChart {
function getChart($data){
$this->data = $data;
}
function showChart($title, $width, $height){
$this->title = $title;
$this->width = $width;
$this->height = $height;
echo '<div class="chartbox" style="width:'.$this->width.'px; height:'.$this->height.'px;">
<h2>'.$this->title.'</h2>'."\r\n";
$this->drawHorizontal();
echo ' </div>';
}
function getDataValue(){
$datavalue1 = 0;
foreach ($this->data as $key=>$value) {
if ($value > $datavalue1) $datavalue1 = $value;
}
return $datavalue1;
}
function getElementNumber(){
return sizeof($this->data);
}
function drawHorizontal(){
$multi = ($this->width-170) / $this->getDataValue();
$datavalue1 = $multi * $this->getDataValue();
$barh = floor(($this->height - 35) / $this->getElementNumber());
$i = 1;
foreach ($this->data as $key=>$value) {
$b = floor($value*$multi);
$color = ($i % 2) + 1;
$i++;
echo ' <div class="barh" style="height:'.$barh.'px;">'."\r\n";
echo ' <div class="barhcaption" style="line-height:'.$barh.'px; width:81px;">'.$key.'</div>'."\r\n";
echo ' <div class="barhimage"><img src="graphicstyle/images/barh'.$color.'.png" style="width:'.$b.'px; height:'.$barh.'px;" alt="" /></div>'."\r\n";
echo ' <div class="barhvalue" style="line-height:'.$barh.'px; width:45px;">'.$value.'</div>'."\r\n";
echo ' </div>';
}
}
}
?>