Esempio n. 1
0
 /**
  * Constructor method
  * @param array            $data an array of ChartDatumAbstract instances
  * @param string           $title the desired title of the series (used to label a series)
  * @param JsWriterAbstract $jsWriter the jswriter, dependency-injected for rendering
  * @throws \UnexpectedValueException
  */
 public function __construct($data, $title = null, JsWriterAbstract $jsWriter)
 {
     self::$count++;
     $tagcount = 0;
     foreach ($data as $datum) {
         if (!$datum instanceof ChartDatumAbstract) {
             throw new \UnexpectedValueException("The data array must consist of instances inheriting from ChartDatumAbstract");
         }
         $datum->setJsWriter($jsWriter)->setSeries($this);
     }
     $this->data = $data;
     if (isset($title)) {
         $this->title = $title;
     } else {
         $this->title = 'Series ' . self::$count;
     }
     $this->jsWriter = $jsWriter;
     $this->jsWriter->initializeSeries($this->title);
 }
Esempio n. 2
0
 /**
  * Registers a series, performing some additional logic
  * @see \Altamira\JsWriter\JsWriterAbstract::initializeSeries()
  * @param \Altamira\Series|string $series
  * @return \Altamira\JsWriter\Flot
  */
 public function initializeSeries($series)
 {
     parent::initializeSeries($series);
     $title = $this->getSeriesTitle($series);
     $this->options['seriesStorage'][$title]['label'] = $title;
     return $this;
 }