Пример #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);
 }
Пример #2
0
 public function buildDashboard()
 {
     $quarterlySales = new ChartComponent('quarterlySales');
     $quarterlySales->setDimensions(6, 6);
     $quarterlySales->setCaption("Quarterly Sales");
     $quarterlySales->setLabels(array("Q1", "Q2", "Q3", "Q4"));
     $quarterlySales->addYAxis('quantity', "Quantity");
     $quarterlySales->addSeries('sales', "Sales", array(13122, 41312, 46132, 51135), array('numberPrefix' => "\$"));
     $quarterlySales->addSeries('quantity', "Quantity", array(121, 392, 420, 489), array('yAxis' => 'quantity'));
     $quarterlySales->addComponentKPI('beverage', array('caption' => 'Beverages', 'value' => 22900, 'numberPrefix' => ' $', 'numberHumanize' => true));
     $quarterlySales->addComponentKPI('vegetable', array('caption' => 'Vegetables', 'value' => 10401, 'numberPrefix' => ' $', 'numberHumanize' => true));
     $quarterlySales->addComponentKPI('dairy', array('caption' => 'Dairy', 'value' => 27700, 'numberPrefix' => ' $', 'numberHumanize' => true));
     $this->addComponent($quarterlySales);
     $numTickets = new KPIComponent('numTickets');
     $numTickets->setDimensions(3, 3);
     $numTickets->setCaption("Open Support Tickets");
     $numTickets->setValue(42);
     $this->addComponent($numTickets);
     $satisfactionGauge = new GaugeComponent('satisfactionGauge');
     $satisfactionGauge->setDimensions(3, 3);
     $satisfactionGauge->setCaption('Customer Satisfaction');
     $satisfactionGauge->setValue(8);
     $satisfactionGauge->setLimits(0, 10);
     $this->addComponent($satisfactionGauge);
     $ticketPriorities = new KPIGroupComponent('ticketPriorities');
     $ticketPriorities->setDimensions(6, 3);
     $ticketPriorities->setCaption('Ticket Priorities');
     $ticketPriorities->addKPI('high', array('caption' => 'High Priority', 'value' => 6));
     $ticketPriorities->addKPI('normal', array('caption' => 'Normal Priority', 'value' => 36));
     $this->addComponent($ticketPriorities);
 }
Пример #3
0
 public function buildDashboard()
 {
     $kpi1 = new KPIComponent("kpi1");
     $kpi1->setCaption("Number of checkouts in 24h");
     $kpi1->setDimensions(3, 2);
     $kpi1->setValue(rand(100, 500));
     $this->addComponent($kpi1);
     $kpi2 = new KPIComponent("kpi2");
     $kpi2->setCaption("Sales in last 24h");
     $kpi2->setDimensions(3, 2);
     $kpi2->setValue(rand(10, 50), array('numberPrefix' => '$'));
     $this->addComponent($kpi2);
     $kpi3 = new KPIComponent("kpi3");
     $kpi3->setCaption("Number of checkouts this week");
     $kpi3->setDimensions(3, 2);
     $kpi3->setValue(rand(600, 1000));
     $this->addComponent($kpi3);
     $kpi4 = new KPIComponent("kpi4");
     $kpi4->setCaption("Total sales this week");
     $kpi4->setDimensions(3, 2);
     $kpi4->setValue(rand(100, 300), array('numberPrefix' => '$'));
     $this->addComponent($kpi4);
     $chart3 = new ChartComponent("chart3");
     $chart3->setCaption("Gender distribution of shoppers");
     $chart3->setDimensions(6, 6);
     $chart3->setLabels(['Female', 'Male']);
     $chart3->addSeries('gender', 'Gender', array(rand(0, 100), rand(0, 100)), array('seriesDisplayType' => 'pie'));
     $this->addComponent($chart3);
     $chart4 = new ChartComponent("chart4");
     $chart4->setCaption("Age group of shoppers");
     $chart4->setDimensions(6, 6);
     $chart4->setLabels(['Under 15', '15-30', '30-45', '45-60', '60+']);
     $chart4->addSeries('age', 'Age', array(rand(1, 10), rand(20, 30), rand(30, 40), rand(20, 30), rand(1, 10)), array('seriesDisplayType' => 'column'));
     $this->addComponent($chart4);
 }
Пример #4
0
 public function buildDashboard()
 {
     $kpi = new KPIComponent('kpi');
     $kpi->setCaption('Open support tickets');
     $kpi->setDimensions(3, 3);
     $kpi->setValue(19);
     $this->addComponent($kpi);
 }
Пример #5
0
 public function buildDashboard()
 {
     $kpi = new KPIComponent("sales_kpi");
     $kpi->setDimensions(3, 2);
     $kpi->setCaption("Sales in 24h");
     $kpi->setValue(3145, array("numberPrefix" => "\$"));
     $this->addComponent($kpi);
 }
Пример #6
0
 public function buildDashboard()
 {
     $kpi = new KPIComponent('kpi');
     $kpi->setCaption('Sales');
     $kpi->setDimensions(3, 3);
     $kpi->setValue(42, array('numberPrefix' => '$', 'valueTextColor' => '#ff000d'));
     $this->addComponent($kpi);
 }
Пример #7
0
 public function buildDashboard()
 {
     $kpi = new KPIComponent('kpi');
     $kpi->setDimensions(3, 3);
     $kpi->setCaption('Online Users');
     $kpi->setValue(10);
     $this->setDashboardTitle('Online Users');
     $this->addComponent($kpi);
 }
Пример #8
0
 public function buildDashboard()
 {
     $kpi = new KPIComponent('c');
     $kpi->setDimensions(3, 3);
     $kpi->setCaption('CCC');
     $kpi->setValue(33);
     $this->setDashboardTitle('DB 3');
     $this->addComponent($kpi);
 }
 public function buildDashboard()
 {
     $kpi = new KPIComponent('b');
     $kpi->setDimensions(3, 3);
     $kpi->setCaption('BBB');
     $kpi->setValue(22);
     $this->setDashboardTitle('KPI');
     $this->addComponent($kpi);
 }
Пример #10
0
 public function buildDashboard()
 {
     $kpi1 = new KPIComponent("kpi1");
     $kpi1->setCaption("Number of checkouts in 24h");
     $kpi1->setDimensions(3, 2);
     $kpi1->setValue(324);
     $this->addComponent($kpi1);
     $kpi2 = new KPIComponent("kpi2");
     $kpi2->setCaption("Sales in last 24h");
     $kpi2->setDimensions(3, 2);
     $kpi2->setValue(47, array('numberPrefix' => '$'));
     $this->addComponent($kpi2);
     $kpi3 = new KPIComponent("kpi3");
     $kpi3->setCaption("Number of checkouts this week");
     $kpi3->setDimensions(3, 2);
     $kpi3->setValue(1024);
     $this->addComponent($kpi3);
     $kpi4 = new KPIComponent("kpi4");
     $kpi4->setCaption("Total sales this week");
     $kpi4->setDimensions(3, 2);
     $kpi4->setValue(245, array('numberPrefix' => '$'));
     $this->addComponent($kpi4);
     $chart1 = new ChartComponent("chart1");
     $chart1->setCaption("Sales per product category");
     $chart1->setDimensions(6, 6);
     $chart1->setLabels(['Beverages', 'Condiments', 'Dairy Products', 'Grains / Cereal', 'Meat / Poultry']);
     $sales = $this->randomGen(5, 4000);
     $chart1->addSeries('sales', 'Sales', $sales, array('numberPrefix' => '$'));
     $chart1->setYAxis('', array('numberPrefix' => '$'));
     $this->addComponent($chart1);
     $chart2 = new ChartComponent("chart2");
     $chart2->setCaption("Sales per employee");
     $chart2->setDimensions(6, 6);
     $chart2->setLabels(['Robert', 'Margaret', 'Nancy', 'Andrew', 'Janet']);
     $chart2->addSeries('sales', 'Sales', [56500, 57590, 65820, 79960, 82030], array('seriesDisplayType' => 'column'));
     $chart2->setYAxis('', array('numberPrefix' => '$'));
     $this->addComponent($chart2);
     $chart3 = new ChartComponent("chart3");
     $chart3->setCaption("Gender distribution of shoppers");
     $chart3->setDimensions(6, 6);
     $chart3->setLabels(['Female', 'Male']);
     $chart3->addSeries('gender', 'Gender', [58, 42], array('seriesDisplayType' => 'pie'));
     $this->addComponent($chart3);
     $chart4 = new ChartComponent("chart4");
     $chart4->setCaption("Age group of shoppers");
     $chart4->setDimensions(6, 6);
     $chart4->setLabels(['Under 15', '15-30', '30-45', '45-60', '60+']);
     $chart4->addSeries('age', 'Age', [8, 28, 32, 22, 10], array('seriesDisplayType' => 'column'));
     $this->addComponent($chart4);
 }
Пример #11
0
 public function buildDashboard()
 {
     $chart = new ChartComponent("chart");
     $chart->setCaption("Expenses incurred for Food Consumption by Year");
     $chart->setDimensions(4, 4);
     $chart->setLabels(array("2009", "2010", "2011"));
     $chart->addSeries("beverages", "Beverages", [1355, 1916, 1150], array('numberPrefix' => '$'));
     $chart->addSeries("packaged_foods", "Packaged Foods", [1513, 976, 1321], array('numberPrefix' => '$'));
     $this->addComponent($chart);
     $kpi = new KPIComponent("kpi");
     $kpi->setValue(0, array('numberPrefix' => '$'));
     $kpi->setDimensions(4, 4);
     $this->addComponent($kpi);
     $chart->onItemClick(array($kpi), 'handleClick', $this);
 }
Пример #12
0
 public function buildDashboard()
 {
     $quarterlySales = new ChartComponent('quarterlySales');
     $quarterlySales->setDimensions(6, 6);
     $quarterlySales->setCaption("Quarterly Sales");
     $quarterlySales->setLabels(array("Q1", "Q2", "Q3", "Q4"));
     $quarterlySales->addYAxis('quantity', "Quantity");
     $quarterlySales->addSeries('sales', "Sales", array(13122, 41312, 46132, 51135), array('numberPrefix' => "\$"));
     $quarterlySales->addSeries('quantity', "Quantity", array(121, 392, 420, 489), array('yAxis' => 'quantity'));
     $quarterlySales->addComponentKPI('beverage', array('caption' => 'Beverages', 'value' => 22900, 'numberPrefix' => ' $', 'numberHumanize' => true));
     $quarterlySales->addComponentKPI('vegetable', array('caption' => 'Vegetables', 'value' => 10401, 'numberPrefix' => ' $', 'numberHumanize' => true));
     $quarterlySales->addComponentKPI('dairy', array('caption' => 'Dairy', 'value' => 27700, 'numberPrefix' => ' $', 'numberHumanize' => true));
     $quarterlySales->addDrillStep('drillIntoMonths', $this);
     $this->addComponent($quarterlySales);
     $numTickets = new KPIComponent('numTickets');
     $numTickets->setDimensions(3, 3);
     $numTickets->setCaption("Open Support Tickets");
     $numTickets->setValue(42);
     $this->addComponent($numTickets);
     $satisfactionGauge = new GaugeComponent('satisfactionGauge');
     $satisfactionGauge->setDimensions(3, 3);
     $satisfactionGauge->setCaption('Customer Satisfaction');
     $satisfactionGauge->setValue(8);
     $satisfactionGauge->setLimits(0, 10);
     $this->addComponent($satisfactionGauge);
     $ticketPriorities = new KPIGroupComponent('ticketPriorities');
     $ticketPriorities->setDimensions(6, 3);
     $ticketPriorities->setCaption('Ticket Priorities');
     $ticketPriorities->addKPI('high', array('caption' => 'High Priority', 'value' => 6));
     $ticketPriorities->addKPI('normal', array('caption' => 'Normal Priority', 'value' => 36));
     $this->addComponent($ticketPriorities);
     $productsTable = new TableComponent('productsTable');
     $productsTable->setDimensions(6, 6);
     $productsTable->setCaption('Products');
     $productsTable->addColumn('name', 'Name');
     $productsTable->addColumn('category', 'Category');
     $productsTable->addColumn('price', 'Price', array('dataType' => "number", 'numberPrefix' => "\$", 'textAlign' => "right", 'numberForceDecimals' => true));
     $productsTable->addMultipleRows($this->tableData);
     $this->addComponent($productsTable);
     $productFilterForm = new FormComponent('productFilterForm');
     $productFilterForm->setDimensions(6, 6);
     $productFilterForm->setCaption('Filter Products');
     $productFilterForm->addMultiSelectField('category', 'Select Category', array('Vegetables', 'Dairy', 'Beverages'));
     $productFilterForm->addTextField('name', 'Product Name Contains');
     $productFilterForm->addNumericRangeField('price', 'Price', array(5, 20));
     $this->addComponent($productFilterForm);
     $productFilterForm->onApplyClick(array($productsTable), 'handleApplyClick', $this);
 }
Пример #13
0
 private function fillData($id, $kpiValue, $caption, $options = array())
 {
     $components = [];
     foreach ($this->dimensions as $key => $value) {
         $kpi = new KPIComponent("kpi" . $id . $key);
         $kpi->setDimensions($value[0], $value[1]);
         $kpi->setCaption($caption);
         $kpi->setValue($kpiValue);
         if (array_key_exists('spark', $options)) {
             $spark = $options['spark'];
             $kpi->setSparkValues($spark[0], $spark[1]);
         }
         $components[] = $kpi;
     }
     return $components;
 }
Пример #14
0
 public function buildDashboard()
 {
     $c1 = new FormComponent("c1");
     $c1->setCaption("Test Form Component");
     $c1->setDimensions(6, 6);
     $c1->addTextField('name', 'Name');
     $c1->addSelectField('products', 'Products', array('Beverages', 'Chips', 'Cookies', 'Cakes', 'Dairy Products', 'Poultry'), array());
     $c1->addMultiSelectField('cities', 'Cities', array('Bangalore', 'San Fransisco', 'New York', 'Melbourne', 'London', 'Rio De Jeneiro'), array());
     $c1->addDateField('delivery_date', 'Delivery Date', array());
     $c1->addDateRangeField('grace_period', 'Grace Period', array());
     $c1->addNumericRangeField('units', 'Units in Stock', array(0, 100));
     $kpi = new KPIComponent('kpi1');
     $kpi->setCaption('Stock');
     $kpi->setDimensions(4, 4);
     $kpi->setValue(24);
     $this->addComponent($kpi);
     $this->addComponent($c1);
     $c1->onApplyClick(array($kpi), 'handleApply', $this);
 }
Пример #15
0
 public function buildDashboard()
 {
     $c1 = new KPIComponent('kpi1');
     $c1->setDimensions(3, 2);
     $c1->setCaption('KPI 1');
     $c1->setValue(42);
     $this->addComponent($c1);
     $c2 = new KPIComponent('kpi2');
     $c2->setDimensions(3, 2);
     $c2->setCaption('KPI 2');
     $c2->setValue(43);
     $this->addComponent($c2);
     $c3 = new KPIComponent('kpi3');
     $c3->setDimensions(3, 2);
     $c3->setCaption('KPI 3');
     $c3->setValue(44);
     $this->addComponent($c3);
     $c1->overrideDisplayOrderIndex(2);
     $c2->overrideDisplayOrderIndex(1);
     $c3->overrideDisplayOrderIndex(0);
 }
Пример #16
0
 public function buildDashboard()
 {
     $kpi = new KPIComponent('kpi');
     $kpi->setDimensions(4, 4);
     $kpi->setCaption('Downloads');
     $kpi->setValue(42);
     $kpi->valueConditionalFormat("value < 50", "green");
     $this->addComponent($kpi);
     $kpi1 = new KPIGroupComponent('kpi1');
     $kpi1->setDimensions(12, 2);
     $kpi1->setCaption('Sales by region 2013');
     $kpi1->addKPI('first', array('caption' => 'Bangalore', 'value' => 2766, 'numberPrefix' => '$'));
     $kpi1->addKPI('second', array('caption' => 'Chennai', 'value' => 1988, 'numberPrefix' => '$'));
     $kpi1->addKPI('third', array('caption' => 'Delhi', 'value' => 1988, 'numberHumanize' => true));
     $kpi1->valueConditionalFormat("value > 2000", "green");
     $kpi1->valueConditionalFormat("value <= 2000", "red");
     $kpi3 = new KPITableComponent('kpi3');
     $kpi3->setDimensions(4, 5);
     $kpi3->setCaption('Sales by region 2013');
     $kpi3->addKPI('first', array('caption' => 'Bangalore', 'value' => 2766, 'numberPrefix' => '$'));
     $kpi3->addKPI('second', array('caption' => 'Chennai', 'value' => 1988, 'numberPrefix' => '$'));
     $kpi3->addKPI('third', array('caption' => 'Delhi', 'value' => 1988, 'numberPrefix' => '$'));
     $kpi3->valueConditionalFormat("value == 1988", "green");
     $kpi3->valueConditionalFormat("value < 1988", "red");
     $this->addComponent($kpi1);
     $this->addComponent($kpi3);
 }
Пример #17
0
 public function buildDashboard()
 {
     $kpi = new KPIComponent('kpi');
     $kpi->setDimensions(4, 4);
     $kpi->setCaption('Downloads');
     $kpi->setValue(42);
     $kpi->bindToEvent("kpiClick", array($kpi), "handleKPIClick", $this);
     $this->addComponent($kpi);
 }
Пример #18
0
 public function buildDashboard()
 {
     $kpi = new KPIComponent("kpi1");
     $kpi->setCaption("Hello world");
     $kpi->setValue(42, array('valueTextColor' => 'red'));
     $kpi->setDimensions(4, 4);
     $kpi->bindToEvent("kpiClick", array($kpi), "handleKPIClick", $this);
     $this->addComponent($kpi);
 }
Пример #19
0
 public function buildDashboard()
 {
     $kpi1 = new KPIComponent("kpi1");
     $kpi1->setCaption("Average Monthly Sales");
     $kpi1->setDimensions(4, 2);
     $kpi1->setValue(513.22, array('numberPrefix' => '$'));
     $this->addComponent($kpi1);
     $kpi2 = new KPIComponent("kpi2");
     $kpi2->setCaption("Average Monthly Units");
     $kpi2->setDimensions(4, 2);
     $kpi2->setValue(22);
     $kpi2->setSparkValues(['Jan', "Feb", 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], [12.31, 10.34, 10.26, 9, 8.210000000000001, 13.41, 14.43, 23.31, 13.41, 11.4, 28.34, 29.21]);
     $this->addComponent($kpi2);
 }
Пример #20
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));
     $kpi2 = new KPIComponent("kpi2");
     $kpi2->setCaption("Hello world");
     $kpi2->setValue(42);
     $kpi2->setDimensions(4, 4);
     $kpi2->setSparkValues(array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'), array(20, 32, 34, 12, 4, 16));
     $this->log('KPI Object', "hello");
     $this->log('KPI', "I am a kpi object");
     $kpi->bindToEvent("kpiClick", array($kpi), "handleKPIClick", $this);
     $kpi2->bindToEvent("kpiClick", array($kpi2), "handleKPIClick2", $this);
     $this->addComponent($kpi);
     $this->addComponent($kpi2);
 }
Пример #21
0
 public function buildDashboard()
 {
     $kpi1 = new KPIComponent('kpi1');
     $kpi1->setDimensions(3, 2);
     $kpi1->setCaption('Click Update');
     $kpi1->setValue(40);
     $kpi2 = new KPIComponent('kpi2');
     $kpi2->setDimensions(3, 2);
     $kpi2->setCaption('Click Remove');
     $kpi2->setValue(44);
     $kpi = new KPITableComponent('kpi');
     $kpi->setDimensions(4, 5);
     $kpi->setCaption('Sales by region 2013');
     $kpi->addKPI('first', array('caption' => 'Bangalore', 'value' => 2766, 'numberPrefix' => '$'));
     $kpi->addKPI('second', array('caption' => 'Chennai', 'value' => 1988, 'numberPrefix' => '$'));
     $kpi->addKPI('third', array('caption' => 'Delhi', 'value' => 1988, 'numberPrefix' => '$'));
     $kpi->setKPIValueColor('first', 'green');
     $kpi->setKPICaptionColor('second', 'red');
     $kpi1->bindToEvent('valueClick', array($kpi), 'handleUpdate', $this);
     $kpi2->bindToEvent('valueClick', array($kpi), 'handledelete', $this);
     $this->addComponent($kpi);
     $this->addComponent($kpi1);
     $this->addComponent($kpi2);
 }
Пример #22
0
 protected function validate()
 {
     parent::validate();
     $this->requireAspects(array('limits' => "Please set the limits using setLimits"));
 }
Пример #23
0
// Link the artist chart to artist sales
$genreSales->autoLink($artistSales);
// Create a table component to show each sale.
$saleTable = new TableComponent();
$saleTable->setCaption("Sales Table");
$saleTable->setWidth(3);
$saleTable->setDataSource($dataSource);
$saleTable->addColumn("Track", "track.Name");
$saleTable->addColumn("Album", "album.Title");
$saleTable->addColumn("Sale Date", "invoice.InvoiceDate", array('width' => 50));
$saleTable->addColumn("Amount", "track.UnitPrice * invoiceLine.Quantity", array('width' => 50, 'textAlign' => 'right', 'numberPrefix' => '$'));
Dashboard::addComponent($saleTable);
// Link the artist chart to the sales table
$artistSales->autoLink($saleTable);
// Create a Key Performance Indicators to measure the total sales last month
$saleKPI = new KPIComponent();
$saleKPI->setCaption("Last Month's sales");
$saleKPI->setDataSource($dataSource);
$saleKPI->setValueExpression("track.UnitPrice * invoiceLine.Quantity", array('aggregate' => true, 'aggregateFunction' => "SUM", 'numberPrefix' => '$'));
$saleKPI->setTimestampExpression("invoice.InvoiceDate", array('timeUnit' => 'month'));
Dashboard::addComponent($saleKPI);
// Link the artist chart to sales KPI
$artistSales->autoLink($saleKPI);
$yearlySalesGauge = new GaugeComponent();
$yearlySalesGauge->setCaption("This Year's sales");
$yearlySalesGauge->setPlaceholder("Please select an artist");
$yearlySalesGauge->setDataSource($dataSource);
$yearlySalesGauge->setValueExpression("invoiceLine.Quantity", array('aggregate' => true, 'aggregateFunction' => "SUM"));
$yearlySalesGauge->setTimestampExpression("invoice.InvoiceDate", array('timeUnit' => 'year'));
$yearlySalesGauge->setKeyPoints(array(5, 10, 20, 30));
Dashboard::addComponent($yearlySalesGauge);