Ejemplo n.º 1
0
 /**
  * Custom serialization of the ChartWrapper.
  *
  * @return array
  */
 public function jsonSerialize()
 {
     if ($this->wrappedObject instanceof Chart) {
         $type = 'chartType';
     }
     if ($this->wrappedObject instanceof Filter) {
         $type = 'controlType';
     }
     return [$type => $this->wrappedObject->getType(), 'containerId' => (string) $this->containerId, 'options' => $this->wrappedObject];
 }
Ejemplo n.º 2
0
 /**
  * Stores a chart in the volcano datastore.
  *
  * @param  \Khill\Lavacharts\Charts\Chart $chart Chart to store in the volcano.
  * @return boolean
  */
 public function storeChart(Chart $chart)
 {
     $this->charts[$chart->getType()][(string) $chart->getLabel()] = $chart;
     return true;
 }
Ejemplo n.º 3
0
 /**
  * Returns the dashboard package data.
  *
  * @access private
  * @param  string $which
  *
  * @return stdClass chart package, version, and type
  */
 private function getDashboardPackageData($which)
 {
     $package = ['type' => 'controls', 'jsObj' => $this->chart->getType(), 'version' => '1'];
     return $package[$which];
 }