/** * Add to plot * @param \Plot $Plot * @param int $yAxis * @param boolean $addAnnotations [optional] */ public function addTo(\Plot &$Plot, $yAxis, $addAnnotations = true) { if (empty($this->Data)) { return; } parent::addTo($Plot, $yAxis, $addAnnotations); $min = min($this->Data); $max = max($this->Data); if ($max - $min <= 50) { $minLimit = $min - 20; $maxLimit = $max + 20; } else { $minLimit = $min; $maxLimit = $max; } $Plot->setYLimits($yAxis, $minLimit, $maxLimit, true); $Plot->setLinesFilled(array($yAxis - 1)); }
/** * Add to plot * @param \Plot $Plot * @param int $yAxis * @param boolean $addAnnotations [optional] */ public function addTo(\Plot &$Plot, $yAxis, $addAnnotations = true) { parent::addTo($Plot, $yAxis, $addAnnotations); $max = $this->showsAsPercentage() ? 100 : $this->HRmax; if (!empty($this->Data)) { $Plot->setYLimits($yAxis, 10 * floor(min($this->Data) / 10), $max); $Plot->addMarkingArea('y' . $yAxis, $max * 1, $max * 0.9, 'rgba(255,100,100,0.3)'); $Plot->addMarkingArea('y' . $yAxis, $max * 0.9, $max * 0.8, 'rgba(255,100,100,0.2)'); $Plot->addMarkingArea('y' . $yAxis, $max * 0.8, $max * 0.7, 'rgba(255,100,100,0.1)'); $Plot->addMarkingArea('y' . $yAxis, $max * 0.7, $max * 0.6, 'rgba(255,100,100,0.05)'); } }
/** * Add to plot * @param \Plot $Plot * @param int $yAxis * @param boolean $addAnnotations [optional] */ public function addTo(\Plot &$Plot, $yAxis, $addAnnotations = true) { if (empty($this->Data)) { return; } parent::addTo($Plot, $yAxis, $addAnnotations); if (!$this->paceInTime) { return; } $Plot->setYAxisTimeFormat('%M:%S', $yAxis); $min = min($this->Data); $max = max($this->Data); $setLimits = false; $autoscale = true; if (Configuration::ActivityView()->ignorePaceOutliers() && $max - $min > 2 * 60 * 1000) { $setLimits = true; $num = count($this->Data); $sorted = $this->Data; sort($sorted); $min = 10 * 1000 * floor($sorted[round(self::$CUT_OUTLIER_PERCENTAGE / 2 / 100 * $num)] / 10 / 1000); $max = 10 * 1000 * ceil($sorted[round((1 - self::$CUT_OUTLIER_PERCENTAGE / 2 / 100) * $num) - 1] / 10 / 1000); } if ($max > 50 * 60 * 1000) { $setLimits = true; $max = 50 * 60 * 1000; } if (Configuration::ActivityView()->paceAxisType()->valueAsString() == PaceAxisType::AS_SPEED) { $LimitMin = Configuration::ActivityView()->paceYaxisMinimum(); if (!$LimitMin->automatic()) { $min = $LimitMin->value() * 1000; } $this->setYAxisForReversePace($Plot, $yAxis, $min); } else { $LimitMin = Configuration::ActivityView()->paceYaxisMinimum(); $LimitMax = Configuration::ActivityView()->paceYaxisMaximum(); if (!$LimitMin->automatic() || !$LimitMax->automatic()) { $setLimits = true; $autoscale = false; if (!$LimitMin->automatic() && $min < 1000 * $LimitMin->value()) { $min = 1000 * $LimitMin->value(); } else { $min = 60 * 1000 * floor($min / 60 / 1000); } if (!$LimitMax->automatic() && $max > 1000 * $LimitMax->value()) { $max = 1000 * $LimitMax->value(); } else { $max = 60 * 1000 * floor($max / 60 / 1000); } } if ($setLimits) { $Plot->setYLimits($yAxis, $min, $max, $autoscale); $Plot->setYAxisLabels($yAxis, null); } } switch (Configuration::ActivityView()->paceAxisType()->valueAsString()) { case PaceAxisType::AS_SPEED: $Plot->setYAxisPaceReverse($yAxis); break; case PaceAxisType::REVERSE: $Plot->setYAxisReverse($yAxis); break; } }
/** * Average * @param int $decimals [optional] * @return int */ protected function avg($decimals = 1) { return parent::avg($decimals); }
/** * Add to plot * @param \Plot $Plot * @param int $yAxis * @param boolean $addAnnotations [optional] */ public function addTo(Plot &$Plot, $yAxis, $addAnnotations = true) { parent::addTo($Plot, $yAxis, $addAnnotations); $Plot->showPoints(2); $Plot->smoothing(false); }