Graph of weight
count($data) - $number; $i--) { if (isset($skips[$i])) { $number++; } } foreach ($data as $week => $weight) { $week++; if ($first == 0) { $first = $weight; } if ($last != 0) { $diffs[] = $weight - $last; } if ($week > count($data) - $number) { $diff = $weight - $last; if ($diff > 0.5) { $class = 'vbad'; } else if ($diff > 0) { $class = 'bad'; } else if ($diff == 0) { $class = 'ok'; } else if ($diff > -1) { $class = 'good'; } else { $class = 'vgood'; } if (!isset($skips[$week - 1])) { echo ''; echo ''; } } $last = $weight; } $a1 = array_sum($diffs) / count($diffs); $a2 = array_sum(array_slice($diffs, -4)) / 4; $a3 = array_pop($diffs); $bmi = $last / (HEIGHT * HEIGHT); $target = 5 * floor($bmi/5); $target2 = $target - 5; $targs = array($target, $target2); $tweeks = array(); foreach ($targets as $targ) { list($tweek, $tbmi) = $targ; if ($bmi > $tbmi && $tweek > $week) { $tweeks[$tbmi] = $tweek; $targs[] = $tbmi; } } rsort($targs); $target = array_shift($targs); $target2 = array_shift($targs); $b35 = $target * HEIGHT * HEIGHT - $last; $b30 = ($target2) * HEIGHT * HEIGHT - $last; $target_s = $target . ' (' . round($target * HEIGHT * HEIGHT, 1) . ')'; $target2_s = $target2 . ' (' . round($target2 * HEIGHT * HEIGHT, 1) . ')'; ?>
WkMassBMI ΔMassΣΔMass
kgstkgst
', $week, '', sprintf('%01.1f', $weight), ''; echo sprintf('%01.1f', $weight / (HEIGHT * HEIGHT), 1), ''; if ($last == 0) { echo '-'; } else { if ($weight - $last > 0) { echo ''; } echo sprintf('%01.1f', $weight - $last); } echo ''; if ($last == 0) { echo '-'; } else { if ($weight - $last > 0) { echo ''; } echo sprintf('%01.1f', 0.157473044 * ($weight - $last)); } echo '', sprintf('%01.1f', $weight - $first), '', sprintf('%01.1f', 0.157473044 * ($weight - $first)), '
TimespanΔMassETA → BMI (KG)
All time = 0 ? 'Never' : date('d M y', strtotime('+'.ceil(abs($b35 / $a1)).'weeks')); ?> = 0 ? 'Never' : date('d M y', strtotime('+'.ceil(abs($b30 / $a1)).'weeks')); ?>
Last month = 0 ? 'Never' : date('d M y', strtotime('+'.ceil(abs($b35 / $a2)).'weeks')); ?> = 0 ? 'Never' : date('d M y', strtotime('+'.ceil(abs($b30 / $a2)).'weeks')); ?>
Last week = 0 ? 'Never' : date('d M y', strtotime('+'.ceil(abs($b35 / $a3)).'weeks')); ?> = 0 ? 'Never' : date('d M y', strtotime('+'.ceil(abs($b30 / $a3)).'weeks')); ?>
Average = 0 ? 'Never' : date('d M y', strtotime('+'.ceil(abs($b35 / (($a1 + $a2 + $a3)/3))).'weeks')); ?> = 0 ? 'Never' : date('d M y', strtotime('+'.ceil(abs($b30 / (($a1 + $a2 + $a3)/3))).'weeks')); ?>