mirror of
https://github.com/Xkeeper0/jul.git
synced 2025-05-19 08:40:21 -07:00
Update activity graph
This commit is contained in:
parent
9c055df5a9
commit
06217b7820
@ -7,7 +7,7 @@
|
||||
$dd = mktime(0,0,0,substr($vd,0,2),substr($vd,3,2),substr($vd,6,2));
|
||||
|
||||
$days = floor((ctime()-$dd)/86400);
|
||||
$scalex = 2;
|
||||
$scalex = 1;
|
||||
$scaley = 20;
|
||||
$m = $max / $scaley;
|
||||
|
||||
|
@ -17,21 +17,23 @@
|
||||
|
||||
$days=ceil((ctime()-$dd)/86400);
|
||||
$scalex = 1;
|
||||
$scaley = 200;
|
||||
$scaley = 500;
|
||||
$m = $max / $scaley;
|
||||
$xs = $days * $scalex;
|
||||
|
||||
$img=ImageCreateTrueColor($xs,$m);
|
||||
|
||||
$c[bg]= ImageColorAllocate($img, 0, 0, 0);
|
||||
$c[bg1]=ImageColorAllocate($img, 0, 0, 60);
|
||||
$c[bg2]=ImageColorAllocate($img, 0, 0, 80);
|
||||
$c[bg3]=ImageColorAllocate($img, 40, 40,100);
|
||||
$c[bg4]=ImageColorAllocate($img,100, 40, 40);
|
||||
$c[mk1]=ImageColorAllocate($img, 60, 60,130);
|
||||
$c[mk2]=ImageColorAllocate($img, 80, 80,150);
|
||||
$c[bar]=ImageColorAllocate($img,250,190, 40);
|
||||
$c[pt] =ImageColorAllocate($img,250,250,250);
|
||||
$c['bg']= ImageColorAllocate($img, 0, 0, 0);
|
||||
$c['bg1']=ImageColorAllocate($img, 0, 0, 60);
|
||||
$c['bg2']=ImageColorAllocate($img, 0, 0, 80);
|
||||
$c['bg3']=ImageColorAllocate($img, 40, 40,100);
|
||||
$c['bg4']=ImageColorAllocate($img,100, 40, 40);
|
||||
$c['mk1']=ImageColorAllocate($img, 60, 60,130);
|
||||
$c['mk2']=ImageColorAllocate($img, 80, 80,150);
|
||||
$c['mk3']=ImageColorAllocate($img,160, 90, 90);
|
||||
$c['mk4']=ImageColorAllocate($img,180,110,110);
|
||||
$c['bar']=ImageColorAllocate($img,250,190, 40);
|
||||
$c['pt'] =ImageColorAllocate($img,250,250,250);
|
||||
for($i=0;$i<$days;$i++){
|
||||
$num=date('m',$dd+$i*86400)%2+1;
|
||||
if(date('m-d',$dd+$i*86400)=='01-01') $num=3;
|
||||
@ -41,44 +43,25 @@
|
||||
|
||||
}
|
||||
for($i=0;$i<=($m / 50);$i++){
|
||||
ImageLine($img,0,$m-$i*100+50,($days + 1) * $scalex - 1,$m-$i*100+50,$c[mk1]);
|
||||
ImageLine($img,0,$m-$i*100,($days + 1) * $scalex - 1,$m-$i*100,$c[mk2]);
|
||||
imagestring($img, 3, 3, $m-$i*100+1, ($i * 100) * $scaley, $c[bg]);
|
||||
imagestring($img, 3, 3, $m-$i*100+51, ($i * 100 - 50) * $scaley, $c[bg]);
|
||||
imagestring($img, 3, 2, $m-$i*100, ($i * 100) * $scaley, $c[mk2]);
|
||||
imagestring($img, 3, 2, $m-$i*100+50, ($i * 100 - 50) * $scaley, $c[mk1]);
|
||||
ImageLine($img,0,$m-$i*100+50,($days + 1) * $scalex - 1,$m-$i*100+50,$c['mk1']);
|
||||
ImageLine($img,0,$m-$i*100,($days + 1) * $scalex - 1,$m-$i*100,$c['mk2']);
|
||||
imagestring($img, 3, 3, $m-$i*100+1, ($i * 100) * $scaley, $c['bg']);
|
||||
imagestring($img, 3, 3, $m-$i*100+51, ($i * 100 - 50) * $scaley, $c['bg']);
|
||||
imagestring($img, 3, 2, $m-$i*100, ($i * 100) * $scaley, $c['mk2']);
|
||||
imagestring($img, 3, 2, $m-$i*100+50, ($i * 100 - 50) * $scaley, $c['mk1']);
|
||||
|
||||
imagestring($img, 3, $xs - 71, $m-$i*100+1, sprintf("%10d", ($i * 100) * $scaley), $c[bg]);
|
||||
imagestring($img, 3, $xs - 71, $m-$i*100+51, sprintf("%10d", ($i * 100 - 50) * $scaley), $c[bg]);
|
||||
imagestring($img, 3, $xs - 72, $m-$i*100, sprintf("%10d", ($i * 100) * $scaley), $c[mk2]);
|
||||
imagestring($img, 3, $xs - 72, $m-$i*100+50, sprintf("%10d", ($i * 100 - 50) * $scaley), $c[mk1]);
|
||||
imagestring($img, 3, $xs - 81, $m-$i*100+1, sprintf("%10d", ($i * 100)), $c['bg']);
|
||||
imagestring($img, 3, $xs - 81, $m-$i*100+51, sprintf("%10d", ($i * 100 - 50)), $c['bg']);
|
||||
imagestring($img, 3, $xs - 82, $m-$i*100, sprintf("%10d", ($i * 100)), $c['mk4']);
|
||||
imagestring($img, 3, $xs - 82, $m-$i*100+50, sprintf("%10d", ($i * 100 - 50)), $c['mk3']);
|
||||
}
|
||||
|
||||
|
||||
$users = array(
|
||||
1 => array('name' => "Total posts ", 'color' => imagecolorallocate($img, 255, 255, 255)),
|
||||
-1 => array('name' => "$alen-day average x 200", 'color' => 0xFF8888),
|
||||
/* 50 => array('name' => "Hyperhacker ", 'color' => imagecolorallocate($img, 50, 255, 50)),
|
||||
61 => array('name' => "E. Prime ", 'color' => imagecolorallocate($img, 200, 200, 0)),
|
||||
18 => array('name' => "Hiryuu ", 'color' => imagecolorallocate($img, 255, 50, 50)),
|
||||
17 => array('name' => "NightKev ", 'color' => imagecolorallocate($img, 200, 0, 200)),
|
||||
/ 5 => array('name' => "Hydrapheetz ", 'color' => imagecolorallocate($img, 50, 50, 255)),
|
||||
3 => array('name' => "cpubasic13 ", 'color' => imagecolorallocate($img, 0, 200, 255)),
|
||||
52 => array('name' => "Shadic ", 'color' => imagecolorallocate($img, 100, 50, 200)),
|
||||
57 => array('name' => "Kles ", 'color' => imagecolorallocate($img, 50, 200, 100)),
|
||||
12 => array('name' => "Dorito ", 'color' => imagecolorallocate($img, 200, 100, 50)),
|
||||
|
||||
36 => array('name' => "Erika ", 'color' => imagecolorallocate($img, 220, 100, 170)),
|
||||
100 => array('name' => "Kas ", 'color' => imagecolorallocate($img, 220, 170, 100)),
|
||||
117 => array('name' => "Rydain ", 'color' => imagecolorallocate($img, 220, 220, 79)),
|
||||
118 => array('name' => "Aiya ", 'color' => imagecolorallocate($img, 170, 150, 255)),
|
||||
175 => array('name' => "Tina ", 'color' => imagecolorallocate($img, 255, 100, 255)),
|
||||
387 => array('name' => "Acmlm ", 'color' => imagecolorallocate($img, 233, 190, 153)),
|
||||
49 => array('name' => "Dr. Sophie ", 'color' => imagecolorallocate($img, 193, 210, 233)),
|
||||
*/
|
||||
// 2 => array('name' => "Drag ", 'color' => imagecolorallocate($img, 255, 0, 0)),
|
||||
|
||||
1 => array('name' => "Total posts ", 'color' => imagecolorallocate($img, 255, 255, 255)),
|
||||
-1 => array('name' => "$alen-day average", 'color' => 0xFF8888),
|
||||
);
|
||||
|
||||
/*
|
||||
$users = array();
|
||||
$userq = $sql -> query("SELECT id, name FROM `users` ORDER BY `posts` DESC LIMIT 0, 10");
|
||||
@ -90,9 +73,9 @@
|
||||
$z = count($users);
|
||||
$namespace = 12;
|
||||
|
||||
imagerectangle( $img, 61, 11, 174 + 6 * 5, 15 + $z * $namespace, $c[bg]);
|
||||
imagefilledrectangle($img, 60, 10, 173 + 6 * 5, 14 + $z * $namespace, $c[bg2]);
|
||||
imagerectangle( $img, 60, 10, 173 + 6 * 5, 14 + $z * $namespace, $c[mk2]);
|
||||
imagerectangle( $img, 61, 11, 174 + 6 * 5, 15 + $z * $namespace, $c['bg']);
|
||||
imagefilledrectangle($img, 60, 10, 173 + 6 * 5, 14 + $z * $namespace, $c['bg2']);
|
||||
imagerectangle( $img, 60, 10, 173 + 6 * 5, 14 + $z * $namespace, $c['mk2']);
|
||||
|
||||
$z = 0;
|
||||
|
||||
@ -101,9 +84,9 @@
|
||||
$data = getdata($uid);
|
||||
drawdata($data, $userx['color']);
|
||||
}
|
||||
imageline($img, 66, $z * $namespace + 19, 76, $z * $namespace + 19, $c[bg]);
|
||||
imageline($img, 66, $z * $namespace + 19, 76, $z * $namespace + 19, $c['bg']);
|
||||
imageline($img, 65, $z * $namespace + 18, 75, $z * $namespace + 18, $userx['color']);
|
||||
imagestring($img, 2, 80 + 1, $z * $namespace + 12, $userx['name'], $c[bg]);
|
||||
imagestring($img, 2, 80 + 1, $z * $namespace + 12, $userx['name'], $c['bg']);
|
||||
imagestring($img, 2, 80, $z * $namespace + 11, $userx['name'], $userx['color']);
|
||||
$z++;
|
||||
}
|
||||
@ -120,7 +103,7 @@
|
||||
die();
|
||||
}
|
||||
drawdata($xdata2, $users[-1]['color']);
|
||||
|
||||
|
||||
Header('Content-type:image/png');
|
||||
ImagePNG($img);
|
||||
ImageDestroy($img);
|
||||
@ -147,12 +130,12 @@
|
||||
|
||||
while ($n = $sql -> fetch($nn)) {
|
||||
$p[$n['d']]=$n['c'];
|
||||
|
||||
|
||||
for ($temp = $n['d']; $temp > $n['d'] - $alen; $temp--) {
|
||||
$xdata[$n['d']] += $p[$temp];
|
||||
}
|
||||
$xdata[$n['d']] /= $alen;
|
||||
|
||||
|
||||
}
|
||||
|
||||
$dat = $sql -> query(
|
||||
@ -170,4 +153,4 @@
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user