/** * 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(); }