qsieve

qsieve Mercurial Source Tree


Root/webinterface/diagramm1.php

<?php

session_start();

if (!isset($_REQUEST["nr"])) $nr=1;
else $nr=intval($_REQUEST["nr"]); // for security reasons

$A = &$_SESSION["DIAGRAMM1_".$nr];

for ($k=1; 6*$k+5<count($A); ++$k)
{
  $x[$k-1]=$A[6*$k+5];
  $samples1[$k-1]=$A[6*$k+2];
  $samples2[$k-1]=$A[6*$k+3];
  $samples3[$k-1]=$A[6*$k+4];
}


$max1=max($samples1); $max2=max($samples2); $max3=max($samples3);
$min1=min($samples1); $min2=min($samples2); $min3=min($samples3);
$delta1=$max1-$min1; $delta2=$max2-$min2; $delta3=$max3-$min3;
if ($delta1==0) $delta1=1;
if ($delta2==0) $delta2=1;
if ($delta3==0) $delta3=1;

$anzsamples = count($x);

for ($i=count($x)-1; $i>=0; $i--)
 {
   $x[$i]-=$x[0];
   $samples1[$i]-=$min1;
   $samples2[$i]-=$min2;
   $samples3[$i]-=$min3;
 }

$breite = 600;
$hoehe = 300;

$im=imagecreate($breite,$hoehe);
$black = imagecolorallocate($im,0,0,0);
$dark = imagecolorallocate($im,60,60,60);
$gray  = imagecolorallocate($im,170,170,170);
$white  = imagecolorallocate($im,255,255,255);
$farbe1 = imagecolorallocate($im,240,100,240);
$farbe2 = imagecolorallocate($im,255,200,50);
$farbe3 = imagecolorallocate($im,100,220,240);


imagesetthickness($im,16);
imageline($im,0,$hoehe,$breite,0,$dark); // Referenzlinie
imagesetthickness($im,1);

$d=$x[count($x)-1]-$x[0]; if ($d!=0) $d=$breite/$d; 
for ($i=0; $i<$anzsamples-1; $i++)
 {
   imageline($im,$x[$i]*$d,0,$x[$i]*$d,$hoehe,$dark);
   //imagesetthickness($im,2);
   if ($max1>0) imageline($im,$x[$i]*$d,$hoehe-$samples1[$i]*$hoehe/$delta1,$x[$i+1]*$d,$hoehe-$samples1[$i+1]* $hoehe/$delta1,$farbe1);
   if ($max2>0) imageline($im,$x[$i]*$d,$hoehe-$samples2[$i]*$hoehe/$delta2,$x[$i+1]*$d,$hoehe-$samples2[$i+1]* $hoehe/$delta2,$farbe2);
   if ($max3>0) imageline($im,$x[$i]*$d,$hoehe-$samples3[$i]*$hoehe/$delta3,$x[$i+1]*$d,$hoehe-$samples3[$i+1]* $hoehe/$delta3,$farbe3);
   //imagesetthickness($im,1);
 }

imagesetthickness($im,2);
// Abzisse
imageline($im,0,$hoehe-4,$breite,$hoehe-4,$gray);
imageline($im,$breite-8,$hoehe-8,$breite,$hoehe-4,$gray);
imageline($im,$breite-8,$hoehe,$breite,$hoehe-4,$gray);
imagestring($im,2,$breite-6,$hoehe-20,"t",$white);

// Ordinate
imageline($im,4,0,4,$hoehe,$gray);
imageline($im,0,4,4,0,$gray);
imageline($im,8,4,4,0,$gray);
imagestring($im,2,10,5,"% of max-min",$white);


imagestring($im,2,0,$hoehe-18,"first entry",$white);
imagestring($im,2,$breite-70,$hoehe-18,"last entry",$white);


imagestring($im,3,12,20,"static relations (min=$min1,max=$max1)",$farbe1);
imagestring($im,3,12,32,"SLP relations (min=$min2,max=$max2)",$farbe2);
imagestring($im,3,12,44,"DLP relations (min=$min3,max=$max3)",$farbe3);


header("Content-type: image/png");
header("Cache-Control: private");
header("Cache-Control: no-cache");
header("Pragma: no-cache");

imagepng($im); imagedestroy($im);

?>
Source at commit 978bc77a6a24 created 11 years 8 months ago.
By Nathan Adams, compile again

Archive Download this file

Branches

Tags

Page rendered in 0.83489s using 11 queries.