/media/sda-magnetic/david/Dok-15-2023-11-27/fernuni-hagen/cs-i-ii/old-cs-2-03/php-graphix-2021-03-04/sensors3-graphics.php


    <?php
            session_start ();
           $myImage = imagecreate(330, $max);
            
        
            $myGray = imagecolorallocate($myImage, 204, 204, 204);
            $myRed = imagecolorallocate($myImage, 200, 40, 40);
            $myBlue = imagecolorallocate($myImage, 20, 240, 20);
        
        
            $old_x = 0;
            $old_y = 0;
            $x = 0;
            $y = 0;
            
            for ($y = 0;  $y < $max;  $y+=30)
                imageline ($myImage, 0, $y, 330, $y, $myBlue);
            
            for ($i = 0;  $i < 10;   $i++) {
                $x += 30;
                $y = $count [$i];
                imageline ($myImage, $x, 0, $x, $max, $myBlue);
                imageline ($myImage, $old_x, $max - $old_y, $x, $max-$y, $myRed);
                imageline ($myImage, $old_x, $max - $old_y-1, $x, $max-$y-1, $myRed);
                imageline ($myImage, $old_x, $max - $old_y-2, $x, $max-$y-2, $myRed);
                $old_x = $x;
                $old_y = $y;
        
            }
        
            ob_start();
            imagepng($myImage);
            printf('<img src="data:image/png;base64,%s"/>', 
            base64_encode(ob_get_clean()));
 
    ?>