Registers a series, performing some additional logic
@see \Altamira\JsWriter\JsWriterAbstract::initializeSeries()
@param \Altamira\Series|string $series
@return \Altamira\JsWriter\Flot
199761
public function initializeSeries( $series )
    {
        parent::initializeSeries($series);
        $title = $this->getSeriesTitle($series);
        $this->options['seriesStorage'][$title]['label'] = $title; 
        return $this;
    }
834594
public function reverseSerie($Series)
    {
        if (!is_array($Series)) {
            $Series = $this->convertToArray($Series);
        }
        foreach ($Series as $Serie) {
            if (isset($this->Data["Series"][$Serie]["Data"])) {
                $this->Data["Series"][$Serie]["Data"] = array_reverse(
                    $this->Data["Series"][$Serie]["Data"]
                );
            }
        }
    }
953929
function copySeries(series) {
  let newSeries = [], i, j;
  for (i = 0; i < series.length; i++) {
    let copy = {};
    for (j in series[i]) {
      if (series[i].hasOwnProperty(j)) {
        copy[j] = series[i][j];
      }
    }
    newSeries.push(copy);
  }
  return newSeries;
}
1170787
def add_series(self, series):
        """"""

        if not isinstance(series, Series):
            raise TypeError("'%s' is not a Series" % str(series))
        self._all_series.append(series)
        series._chart = self
644987
function (cb, context) {
        assertSeriesInitialized(this);
        each(this._seriesIndices, function (rawSeriesIndex) {
            var series = this._componentsMap.get('series')[rawSeriesIndex];
            cb.call(context, series, rawSeriesIndex);
        }, this);
    }
837975
public double stDev(double[] series) {
    double num0 = 0D;
    double sum = 0D;
    int count = 0;
    for (double tp : series) {
      num0 = num0 + tp * tp;
      sum = sum + tp;
      count += 1;
    }
    double len = ((Integer) count).doubleValue();
    return Math.sqrt((len * num0 - sum * sum) / (len * (len - 1)));
  }
430266
public function addSeries( $seriesOrArray )
	{
	    if (! is_array( $seriesOrArray ) ) {
	        $seriesOrArray = array( $seriesOrArray );
	    }
	    
	    if ( is_array( $seriesOrArray ) ) {
	        foreach ( $seriesOrArray as $series ) 
	        {
	            if (! $series instanceof Series ) {
	                throw new \UnexpectedValueException( '\Altamira\Chart::addSeries expects a single series or an array of series instances' );
	            } 
	            $this->addSingleSeries( $series );
	        }
	    }
	    
	    return $this;
	}
691089
public function setSerieWeight($Series, $Weight = 0)
    {
        if (!is_array($Series)) {
            $Series = $this->convertToArray($Series);
        }
        foreach ($Series as $Serie) {
            if (isset($this->Data["Series"][$Serie])) {
                $this->Data["Series"][$Serie]["Weight"] = $Weight;
            }
        }
    }
337128
public function getById(int $id): Series
    {
        /* @var TheTVDbAPILanguageFallback $parent */
        $parent  = $this->parent;
        $closure = $this->getClosureById($id);

        return $parent->getGenerator()->create($closure, Series::class, $this->parent->getAcceptedLanguages(), true);
    }
710352
public PieSeries addSeries(String seriesName, Number value) {

    PieSeries series = new PieSeries(seriesName, value);

    if (seriesMap.keySet().contains(seriesName)) {
      throw new IllegalArgumentException(
          "Series name >"
              + seriesName
              + "< has already been used. Use unique names for each series!!!");
    }
    seriesMap.put(seriesName, series);

    return series;
  }
397702
public function setSerieOnAxis($Series, $AxisID)
    {
        if (!is_array($Series)) {
            $Series = $this->convertToArray($Series);
        }
        foreach ($Series as $Serie) {
            $PreviousAxis = $this->Data["Series"][$Serie]["Axis"];

            /* Create missing axis */
            if (!isset($this->Data["Axis"][$AxisID])) {
                $this->Data["Axis"][$AxisID]["Position"] = AXIS_POSITION_LEFT;
                $this->Data["Axis"][$AxisID]["Identity"] = AXIS_Y;
            }

            $this->Data["Series"][$Serie]["Axis"] = $AxisID;

            /* Cleanup unused axis */
            $Found = false;
            foreach ($this->Data["Series"] as $Values) {
                if ($Values["Axis"] == $PreviousAxis) {
                    $Found = true;
                }
            }
            if (!$Found) {
                unset($this->Data["Axis"][$PreviousAxis]);
            }
        }
    }
1193101
public static function init($reset = false)
    {
        if (!static::$namespaces || $reset) {
            $namespaces = new \SplPriorityQueue();

            $namespaces->insert(static::$defaultNamespace, $reset);

            static::$namespaces = $namespaces;
        }
    }
374028
public function initial($collection=null, $n=null) {
    list($collection, $n) = self::_wrapArgs(func_get_args(), 2);
    
    $collection = (array) self::_collection($collection);
    
    if(is_null($n)) $n = 1;
    $first_index = count($collection) - $n;
    $__ = new self;
    return self::_wrap($__->first($collection, $first_index));
  }
513864
function () {
            var series = this,
              seriesOptions = series.options,
              chart = series.chart,
              axisOptions;

            each(series.axisTypes || [], function (AXIS) { // repeat for xAxis and yAxis

                each(chart[AXIS], function (axis) { // loop through the chart's axis objects
                    axisOptions = axis.options;

                    // apply if the series xAxis or yAxis option mathches the number of the
                    // axis, or if undefined, use the first axis
                    if ((seriesOptions[AXIS] === axisOptions.index) ||
                      (seriesOptions[AXIS] !== UNDEFINED && seriesOptions[AXIS] === axisOptions.id) ||
                      (seriesOptions[AXIS] === UNDEFINED && axisOptions.index === 0)) {

                        // register this series in the axis.series lookup
                        axis.series.push(series);

                        // set this series.xAxis or series.yAxis reference
                        series[AXIS] = axis;

                        // mark dirty for redraw
                        axis.isDirty = true;
                    }
                });

                // The series needs an X and an Y axis
                if (!series[AXIS] && series.optionalAxis !== AXIS) {
                    error(18, true);
                }

            });
        }
1243210
public function setSeriesOption( $series, $name, $value )
    {
        $this->setNestedOptVal( $this->options, 'seriesStorage', $this->getSeriesTitle( $series ), $name, $value );
        return $this;
    }
930922
public function setShadow($series, $opts = array('use'    => true, 
                                                     'angle'  => 45, 
                                                     'offset' => 1.25, 
                                                     'depth'  => 3, 
                                                     'alpha'  => 0.1 ) )
    {
        extract($opts);
        
        $series = $this->getSeriesTitle( $series );
        
        $use    = isset( $use )    ? $use    : true;
        $angle  = isset( $angle )  ? $angle  : 45;
        $offset = isset( $offset ) ? $offset : 1.25; 
        $depth  = isset( $depth )  ? $depth  : 3; 
        $alpha  = isset( $alpha )  ? $alpha  : 0.1;
        
        return $this->setNestedOptVal( $this->options, 'seriesStorage', $series, 'shadow', $use )
                    ->setNestedOptVal( $this->options, 'seriesStorage', $series, 'shadowAngle', $angle )
                    ->setNestedOptVal( $this->options, 'seriesStorage', $series, 'shadowOffset', $offset )
                    ->setNestedOptVal( $this->options, 'seriesStorage', $series, 'shadowDepth', $depth )
                    ->setNestedOptVal( $this->options, 'seriesStorage', $series, 'shadowAlpha', $alpha ); 
    }
1054570
public function setSerieShape($Series, $Shape = SERIE_SHAPE_FILLEDCIRCLE)
    {
        if (!is_array($Series)) {
            $Series = $this->convertToArray($Series);
        }
        foreach ($Series as $Serie) {
            if (isset($this->Data["Series"][$Serie])) {
                $this->Data["Series"][$Serie]["Shape"] = $Shape;
            }
        }
    }