/** * Create series * @var \Runalyze\View\Activity\Context $context */ public function __construct(Activity\Context $context) { $this->paceUnit = $context->sport()->paceUnit(); $this->paceInTime = $this->paceUnit == \Runalyze\Activity\Pace::MIN_PER_KM || $this->paceUnit == \Runalyze\Activity\Pace::MIN_PER_100M || $this->paceUnit == \Runalyze\Activity\Pace::MIN_PER_500M; $this->isRunning = $context->sport()->id() == Configuration::General()->runningSport(); $this->initOptions(); $this->initData($context->trackdata(), Trackdata::PACE); $this->manipulateData(); }
/** * Create series * @var \Runalyze\View\Activity\Context $context */ public function __construct(Activity\Context $context) { $this->paceUnit = $context->sport()->paceUnit(); $this->paceUnitEnum = $context->sport()->paceUnitEnum(); $this->isRunning = $context->sport()->id() == Configuration::General()->runningSport(); $this->initOptions(); $this->initData($context->trackdata(), Trackdata::PACE); $this->manipulateData(); }
/** * Display rounds */ protected function displayTable() { $this->DemandedPace->setUnit($this->Context->sport()->paceUnit()); $Table = new Table($this->Laps, $this->DemandedTime, $this->DemandedPace, $this->Context->sport()->id() == Configuration::General()->runningSport()); if ($this->LapDistance > 0) { $Table->setAverage($this->Context->dataview()->pace(), new Duration($this->Context->trackdata()->totalTime() / $this->Context->trackdata()->totalDistance() * $this->LapDistance)); } else { $Table->setAverage($this->Context->dataview()->pace()); } $Table->display(); }
/** * Init sections */ protected function initSections() { if (Configuration::ActivityView()->mapFirst() && Configuration::ActivityView()->plotMode()->showCollection()) { $this->Sections[] = new SectionComposite($this->Context); $this->Sections[] = new SectionLaps($this->Context); } else { $this->Sections[] = new SectionOverview($this->Context); if (Configuration::ActivityView()->mapFirst()) { $this->Sections[] = new SectionRouteOnlyMap($this->Context); } else { $this->Sections[] = new SectionLaps($this->Context); } $this->Sections[] = new SectionSwimLane($this->Context); if (Configuration::ActivityView()->plotMode()->showSeperated()) { $this->Sections[] = new SectionHeartrate($this->Context); $this->Sections[] = new SectionPace($this->Context); if (Configuration::ActivityView()->mapFirst()) { $this->Sections[] = new SectionRouteOnlyElevation($this->Context); } else { $this->Sections[] = new SectionRoute($this->Context); } } else { $this->Sections[] = new SectionComposite($this->Context); if (Configuration::ActivityView()->plotMode()->showPaceAndHR()) { if (Configuration::ActivityView()->mapFirst()) { $this->Sections[] = new SectionRouteOnlyElevation($this->Context); } else { $this->Sections[] = new SectionRoute($this->Context); } } else { if (!Configuration::ActivityView()->mapFirst()) { $this->Sections[] = new SectionRouteOnlyMap($this->Context); } } } if (Configuration::ActivityView()->mapFirst()) { $this->Sections[] = new SectionLaps($this->Context); } } if ($this->Context->trackdata()->has(\Runalyze\Model\Trackdata\Object::CADENCE) && $this->Context->sport()->id() == Configuration::General()->runningSport() || $this->Context->trackdata()->has(\Runalyze\Model\Trackdata\Object::GROUNDCONTACT) || $this->Context->trackdata()->has(\Runalyze\Model\Trackdata\Object::VERTICAL_OSCILLATION)) { $this->Sections[] = new SectionRunningDynamics($this->Context); $this->Sections[] = new SectionMiscellaneous($this->Context, false); } else { $this->Sections[] = new SectionMiscellaneous($this->Context, true); } if ($this->Context->hasHRV()) { $this->Sections[] = new SectionHRV($this->Context); } }
/** * Load data * @param \Runalyze\View\Activity\Context $context */ protected function loadData(Activity\Context $context) { $Splits = $context->activity()->splits(); if ($Splits->isEmpty() || $Splits->totalDistance() <= 0) { $this->Plot->raiseError(__('There are no manual laps.')); return; } $this->readDataFromSplits($Splits, !$Splits->hasActiveLaps(2)); $num = count($this->Data); $Reader = new StringReader($context->activity()->comment()); $this->demandedPace = $Reader->findDemandedPace(); $this->achievedPace = array_sum($this->Data) / $num; $paceUnit = $context->sport()->paceUnit(); $this->manipulateData($num, $paceUnit); }
/** * Init data * @param \Runalyze\View\Activity\Context $context */ protected function initData(Activity\Context $context) { $this->PaceUnit = $context->sport()->paceUnit(); $this->SplitsAreNotComplete = $this->splitsAreNotComplete($context); $this->loadData($context); if (!empty($this->Data) && ($this->PaceUnit == APace::MIN_PER_KM || $this->PaceUnit == APace::MIN_PER_100M || $this->PaceUnit == APace::MIN_PER_500M)) { $max = Helper::ceilFor(max($this->Data), 30000); $this->Plot->setYAxisTimeFormat('%M:%S'); } else { $max = ceil(max($this->Data)); $pace = new APace(0, 1, $this->PaceUnit); $this->Plot->addYUnit(1, str_replace(' ', '', $pace->appendix()), 1); } $this->Plot->setYLimits(1, 0, $max, false); $this->Plot->setXLabels($this->Labels); $this->Plot->showBars(true); $this->Plot->setYTicks(1, null); $this->Plot->Options['xaxis']['show'] = true; // force to show xaxis-labels, even if no time or distance array is given $this->addAnnotations(); }