/** * 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]; }
/** * 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; }
/** * 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]; }