} $Query = ' SELECT YEAR(FROM_UNIXTIME(`time`)) as `y`, MONTH(FROM_UNIXTIME(`time`)) as `m`, AVG(`temperature`) as `temp` FROM `' . PREFIX . 'training` WHERE !ISNULL(`temperature`) GROUP BY `y`, `m` ORDER BY `y` ASC, `m` ASC'; $Data = DB::getInstance()->query($Query)->fetchAll(); foreach ($Data as $dat) { $Temperatures[$dat['y']][$dat['m'] - 1] = (int) $dat['temp']; } $Plot = new Plot("average", 780, 240); for ($y = START_YEAR, $n = date('Y'); $y <= $n; $y++) { if (min($Temperatures[$y]) != null || max($Temperatures[$y]) != null) { $Plot->Data[] = array('label' => $y, 'data' => $Temperatures[$y]); } } $Plot->setMarginForGrid(5); $Plot->setXLabels($Months); $Plot->addYAxis(1, 'left'); $Plot->addYUnit(1, '°C', 1); $Plot->setYTicks(1, 5, 0); $Plot->addThreshold('y', 0); $Plot->addMarkingArea('y', -99, 0); $Plot->lineWithPoints(); $Plot->smoothing(false); $Plot->outputJavaScript();
$yAxis[$id] = array(0, 0, 0, 0, 0, 0, 0); $Query->execute(array(':id' => $sport['id'])); $data = $Query->fetchAll(); foreach ($data as $dat) { $yAxis[$id][($dat['day'] + 6) % 7] = $dat['value'] / 3600; } } $Plot = new Plot("weekday", 350, 190); $max = 0; foreach ($yAxis as $key => $data) { $Plot->Data[] = array('label' => $key, 'data' => $data); $max += max($data); } $Plot->setLegendAsTable(); $Plot->setMarginForGrid(5); $Plot->setXLabels($xAxis); $Plot->addYAxis(1, 'left'); $Plot->addYUnit(1, 'h'); $Plot->setYTicks(1, 1, 0); $Plot->setYLimits(1, 0, $max); $Plot->showBars(true); $Plot->stacked(); $error = true; foreach ($yAxis as $t) { foreach ($t as $e) { if ($e != "0") { $error = false; } } } if ($error === true) {
} $Labels = array_keys($Weights); foreach ($Labels as $i => &$value) { if ($i != 0 && $i != count($Labels) - 1) { $value = ''; } } $Plot = new Plot("sportler_weights", 320, 150); if ($Plugin->Configuration()->value('use_weight')) { $Plot->Data[] = array('label' => __('Weight'), 'color' => '#008', 'data' => $Weights); } if ($Plugin->Configuration()->value('use_pulse')) { $Plot->Data[] = array('label' => __('Resting HR'), 'color' => '#800', 'data' => $HRrests, 'yaxis' => 2); } $Plot->setMarginForGrid(5); $Plot->setXLabels($Labels); $Plot->setXAxisTimeFormat('%m/%y'); $Plot->setXAxisMaxToToday(); $Plot->Options['xaxis']['labelWidth'] = 50; //$Plot->Options['xaxis']['tickLength'] = 3; $Plot->Options['series']['curvedLines']['fit'] = true; $Plot->addYAxis(1, 'left'); $Plot->addYUnit(1, 'kg', 1); $Plot->setYTicks(1, 2, 0); $Plot->addYAxis(2, 'right', false); $Plot->addYUnit(2, 'bpm', 0); $Plot->setYTicks(2, 1, 0); if ($Wunschgewicht > 1) { $Plot->addThreshold('y1', $Wunschgewicht); $Plot->addMarkingArea('y1', $Wunschgewicht, 0); }