public function buildDashboard() { $sourceChart = new ChartComponent("sourceChart"); $sourceChart->setDimensions(4, 4); $sourceChart->setCaption("2011 Sales"); $sourceChart->setLabels(["Beverages", "Vegetables"]); $sourceChart->addSeries("sales", "Sales", [1343, 7741]); $sourceChart->addSeries("quantity", "Quantity", [76, 119]); $this->addComponent($sourceChart); $targetChart = new ChartComponent("targetChart"); $targetChart->hideComponent(); $this->addComponent($targetChart); $sourceChart->onItemClick(array($sourceChart, $targetChart), "handleItemClick", $this); }
public function buildDashboard() { $chart1 = new ChartComponent('my_chart1'); $chart1->setDimensions(6, 4); $chart1->setCaption('Top 10 Genres by sales'); $chart1->setLabels(['Rock', 'Latin', 'Metal', 'Alternative & Punk', 'TV Shows', 'Jazz', 'Blues', 'Drama', 'R&B/Soul', 'Classical']); $chart1->addSeries('sales', 'Sales', [826.25, 382.14, 261.36, 241.56, 93.53, 79.2, 60.39, 57.71, 40.59, 40.59]); $chart1->setYAxis('', array('numberPrefix' => '$')); $c2 = new ChartComponent('my_chart2'); $c2->setDimensions(6, 4); $c2->setCaption('Units By Year'); $c2->hideComponent(); $chart1->onItemClick(array($chart1, $c2), 'handleClick', $this); $this->addComponent($chart1); $this->addComponent($c2); }