hello DeGauss!
i have a small function - i hope it will help you
$daysAlive... how many days is a person alive
$period...... physically: 23
emotional: 28
intelectual: 33
$color....... wished color for the line
function drawRhythm($daysAlive, $period, $color)
{
global $daysToShow, $image, $diagramWidth, $diagramHeight, $yoffset, $xoffset;
$diagramweite = $diagramWidth - $xoffset;
// Die Kurve auf diesen Tag zentrieren
$centerDay = $daysAlive - ($daysToShow / 2);
// Skalierung und Nullpunkt der Kurve
$plotScale = ($diagramHeight - $yoffset) / 2;
$plotCenter = ($diagramHeight - $yoffset) / 2;
// Kurve zeichnen
$oldX = $xoffset;
$oldy = 0;
for ($x = 0; $x <= $daysToShow; $x++)
{
$phase = (($centerDay + $x) % $period) / $period 2 pi();
$y = 1 - sin($phase) * (float)$plotScale + (float)$plotCenter;
if ($x > 0)
imageLine($image, $oldX, $oldY, ($x * $diagramweite / $daysToShow)+$xoffset, $y, $color);
imageLine($image, $oldX, $oldY-1, ($x * $diagramweite / $daysToShow)+$xoffset, $y-1, $color);
$oldX = ($x * $diagramweite / $daysToShow) + $xoffset;
$oldY = $y;
}
$phase = (($daysAlive) % $period) / $period 2 pi();
$proz = 100;
$y = sin($phase) * (float)$proz; // + (float)$plotCenter;
$holla = round($y,2);
return str_replace(".",",",$holla);
}