Exemplo n.º 1
0
$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);
}
if (empty($Data)) {
Exemplo n.º 2
0
$timeFormat = '%M:%S';
$competitions = $this->RaceContainer->races($distance);
//$competitions = DB::getInstance()->query('SELECT id,time,s FROM `'.PREFIX.'training` WHERE `typeid`='.Configuration::General()->competitionType().' AND `distance`="'.$distance.'" ORDER BY `time` ASC')->fetchAll();
if (!empty($competitions)) {
    foreach ($competitions as $competition) {
        if (!$this->isFunCompetition($competition['id'])) {
            $Dates[] = $competition['time'];
            $Results[$competition['time'] . '000'] = $competition['s'] * 1000;
            // Attention: timestamp(0) => 1:00:00
        }
    }
    if (!empty($Results) && max($Results) > 3600 * 1000) {
        $timeFormat = '%H:%M:%S';
    }
}
$Plot = new Plot("bestzeit" . $distance * 1000, 480, 190);
$Plot->Data[] = array('label' => $label, 'data' => $Results);
//$Plot->Data[] = array('label' => $trend, 'data' => $Results, 'color' => '#C61D17', 'lines' => array('show' => true), 'curvedLines' => array('apply' => true, 'fit' => true));
//$Plot->Data[] = array('label' => $label, 'data' => $Results, 'color' => '#C61D17', 'points' => array('show' => true), 'curvedLines' => array('apply' => false));
$Plot->setMarginForGrid(5);
$Plot->setXAxisAsTime();
if (count($Results) == 1) {
    $Plot->setXAxisTimeFormat('%d.%m.%y');
}
$Plot->addYAxis(1, 'left');
$Plot->setYAxisAsTime(1);
$Plot->setYAxisTimeFormat($timeFormat, 1);
$Plot->smoothing(false);
$Plot->lineWithPoints();
$Plot->setTitle($titleCenter);
$Plot->outputJavaScript();