/** * @return \Runalyze\View\Plot\Series */ protected function seriesForDouglasPeucker() { $Series = new PlotSeries(); $Series->setColor('#800'); $Series->setLabel(__('Douglas-Peucker')); $Series->setData($this->constructPlotDataFor(ElevationMethod::DOUGLAS_PEUCKER)); return $Series; }
/** * 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); switch ($this->XAxis) { case DataCollector::X_AXIS_DISTANCE: $Plot->setXUnitFactor(Configuration::General()->distanceUnitSystem()->distanceToPreferredUnitFactor(), Configuration::General()->distanceUnitSystem()->distanceUnit()); $stepSize = Configuration::General()->distanceUnitSystem()->distanceToKmFactor(); if ($stepSize != round($stepSize)) { end($this->Data); $totalDistanceInKm = key($this->Data); while ($totalDistanceInKm / $stepSize > 15) { $stepSize *= 2; } while ($totalDistanceInKm / $stepSize < 4) { $stepSize /= 2; } $Plot->Options['xaxis']['tickSize'] = $stepSize; } break; case DataCollector::X_AXIS_TIME: $Plot->setXAxisAsTime(); $Plot->setXAxisTimeFormat("%h:%M:%S"); $Plot->Options['xaxis']['ticks'] = 5; break; case DataCollector::X_AXIS_INDEX: $Plot->hideXLabels(); } }
/** * 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); switch ($this->XAxis) { case DataCollector::X_AXIS_DISTANCE: $Plot->setXUnit('km'); break; case DataCollector::X_AXIS_TIME: $Plot->setXAxisAsTime(); $Plot->setXAxisTimeFormat("%h:%M:%S"); $Plot->Options['xaxis']['ticks'] = 5; break; case DataCollector::X_AXIS_INDEX: $Plot->hideXLabels(); } }
/** * Add series * @param \Runalyze\View\Plot\Series $series * @param int $yAxis * @param boolean $addAnnotations */ protected final function addSeries(\Runalyze\View\Plot\Series $series, $yAxis = 1, $addAnnotations = true) { $series->addTo($this->Plot, $yAxis, $addAnnotations); }