Esempio n. 1
0
 public function buildDashboard()
 {
     $kpi = new KPIComponent("kpi1");
     $kpi->setCaption("Hello world");
     $kpi->setValue(42);
     $kpi->setDimensions(4, 4);
     $kpi->setSparkValues(array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'), array(20, 32, 34, 12, 4, 16));
     $this->addComponent($kpi);
     $table = new TableComponent('table1');
     $table->setCaption("Table 1");
     $table->setDimensions(6, 6);
     $table->addColumn('colA', "Column A");
     $table->addColumn('colB', "Column B");
     for ($i = 0; $i < 2; $i++) {
         $table->addRow(array('colA' => $i * 2, 'colB' => $i * 2 + 1));
     }
     $this->addComponent($table);
     $kpi2 = new KPIComponent("kpi2");
     $kpi2->setCaption("KPI 2");
     $kpi2->setValue(45);
     $kpi2->setDimensions(4, 4);
     $this->addComponent($kpi2);
     // $chart = new ChartComponent('my_chart');
     // $chart->setCaption("Chart 1");
     // $chart->setDimensions(4,4);
     // $chart->setLabels(['January', 'February', 'March', 'April', 'May']);
     // $chart->addSeries("seriesA", "Series A", [1, 3, 5, 1, 9], null);
     // $chart->addSeries("seriesB", "Series B", [3, 1, 9, 2, 3], null);
     // $this->addComponent ($chart);
     $kpi->bindToEvent("kpiClick", array($kpi2, $table), "handleKPIClick", $this);
 }
Esempio n. 2
0
 public function buildDashboard()
 {
     $table = new TableComponent('table1');
     $table->setCaption("Table 1");
     $table->setDimensions(6, 6);
     $table->setRowsPerPage(8);
     $table->addColumn('colA', "Column A");
     $table->addColumn('colB', "Column B");
     for ($i = 0; $i < 10; $i++) {
         // Single Row
         $table->addRow(array('colA' => $i * 2, 'colB' => $i * 2 + 1));
     }
     $table->cellConditionalFormat("colA", "value>300", array("cellBackgroundColor" => "#000", "cellTextColor" => "#fff"));
     $this->addComponent($table);
 }
Esempio n. 3
0
 public function buildDashboard()
 {
     $table = new TableComponent('table1');
     $table->setCaption("Table 1");
     $table->setDimensions(6, 6);
     $table->setRowsPerPage(8);
     $table->addColumn('colA', "Column A");
     $table->addColumn('colB', "Column B");
     for ($i = 0; $i < 10; $i++) {
         // Single Row
         $table->addRow(array('colA' => $i * 2, 'colB' => $i * 2 + 1));
     }
     // Multiple Rows
     $rows = array(array('colA' => 111, 'colB' => 22), array('colA' => 222, 'colB' => 33), array('colA' => 333, 'colB' => 44));
     $table->addMultipleRows($rows);
     $this->addComponent($table);
 }
Esempio n. 4
0
 function addRow($var_args)
 {
     $row = array();
     $n_args = func_num_args();
     for ($ai = 0; $ai < $n_args; $ai++) {
         array_push($row, func_get_arg($ai));
     }
     parent::addRow($row);
 }
Esempio n. 5
0
 public function buildDashboard()
 {
     $table = new TableComponent("table");
     $table->setCaption("IMDB Top 20");
     $table->setDimensions(12, 8);
     $table->addColumn('rank', 'Rank');
     $table->addColumn('title', 'Title');
     $table->addColumn('year', 'Year');
     $table->addColumn('rating', 'IMDB Rating');
     $table->addRow(array('rank' => 1, 'title' => 'The Shawshank Redemption', 'year' => '1994', 'rating' => 9.199999999999999));
     $table->addRow(array('rank' => 2, 'title' => 'The Godfather', 'year' => '1972', 'rating' => 9.199999999999999));
     $table->addRow(array('rank' => 3, 'title' => 'The Godfather part II', 'year' => '1974', 'rating' => 9.0));
     $table->addRow(array('rank' => 4, 'title' => 'The Dark Knight', 'year' => '2008', 'rating' => 8.9));
     $table->addRow(array('rank' => 5, 'title' => 'Pulp Fiction', 'year' => '1994', 'rating' => 8.9));
     $table->addRow(array('rank' => 6, 'title' => 'The Good, the Bad and the Ugly', 'year' => '1966', 'rating' => 8.9));
     $table->addRow(array('rank' => 7, 'title' => 'Schindler\'s List', 'year' => '1993', 'rating' => 8.9));
     $table->addRow(array('rank' => 8, 'title' => 'Angry Men', 'year' => '1957', 'rating' => 8.9));
     $table->addRow(array('rank' => 9, 'title' => 'The Lord of the Rings: The Return of the King', 'year' => '2003', 'rating' => 8.9));
     $table->addRow(array('rank' => 10, 'title' => 'Fight Club', 'year' => '1999', 'rating' => 8.800000000000001));
     $table->addRow(array('rank' => 11, 'title' => 'The Lord of the Rings: The Fellowship of the Ring', 'year' => '2001', 'rating' => 8.800000000000001));
     $table->addRow(array('rank' => 12, 'title' => 'Star Wars: Episode V - The Empire Strikes Back', 'year' => '1980', 'rating' => 8.800000000000001));
     $table->addRow(array('rank' => 13, 'title' => 'Inception', 'year' => '2010', 'rating' => 8.699999999999999));
     $table->addRow(array('rank' => 14, 'title' => 'Forrest Gump', 'year' => '1994', 'rating' => 8.699999999999999));
     $table->addRow(array('rank' => 15, 'title' => 'One Flew Over the Cuckoo\'s Nest', 'year' => '1975', 'rating' => 8.699999999999999));
     $table->addRow(array('rank' => 16, 'title' => 'The Lord of the Rings: The Two Towers', 'year' => '2002', 'rating' => 8.699999999999999));
     $table->addRow(array('rank' => 17, 'title' => 'Goodfellas', 'year' => '1990', 'rating' => 8.699999999999999));
     $table->addRow(array('rank' => 18, 'title' => 'Star Wars: Episode IV - A New Hope', 'year' => '1977', 'rating' => 8.699999999999999));
     $table->addRow(array('rank' => 19, 'title' => 'The Matrix', 'year' => '1999', 'rating' => 8.699999999999999));
     $table->addRow(array('rank' => 20, 'title' => 'Seven Samurai', 'year' => '1954', 'rating' => 8.699999999999999));
     $this->addComponent($table);
 }