本文整理汇总了PHP中Dashboard::addComponent方法的典型用法代码示例。如果您正苦于以下问题:PHP Dashboard::addComponent方法的具体用法?PHP Dashboard::addComponent怎么用?PHP Dashboard::addComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dashboard
的用法示例。
在下文中一共展示了Dashboard::addComponent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MySQLDataSource
<?php
require_once "rf/razorflow.php";
require_once "models/config.php";
if (!securePage($_SERVER['PHP_SELF'])) {
die;
}
require_once "models/header.php";
//Left Nav bar
echo "\r\n<body>\r\n<div id='wrapper'>\r\n<div id='top'><div id='logo'></div></div>\r\n<div id='content'>\r\n\r\n<div id='left-nav'>";
include "left-nav.php";
//Main Content
echo "\r\n</div>\r\n<div id='main'>\r\n";
$dataSource = new MySQLDataSource('2013teamb', '2013teamb', '29G8l!06J82ofpPw', 'devdb.fulgentcorp.com');
$dataSource->setSQLSource('Item');
// Create a chart to show aggregated sales by genre
$itemPriority = new ChartComponent();
$itemPriority->setCaption("Item Priority");
$itemPriority->setDataSource($dataSource);
$itemPriority->setLabelExpression("Name", "Item.ItemName");
$itemPriority->addSeries("Priority", "Item.Priority");
$itemPriority->setOption('limit', 10);
Dashboard::addComponent($itemPriority);
Dashboard::Render();
echo "\r\n</div>\r\n\r\n\r\n<div id='bottom'></div>\r\n</div>\r\n</body>\r\n</html>";
示例2: mysqli_query
$project = mysqli_query($connection, "SELECT * FROM " . "Project WHERE ProjectName = '{$token}'");
$projectInfo = mysqli_fetch_array($project);
$ProjectID = $projectInfo['ProjectID'];
$ProjectName = $projectInfo['ProjectName'];
$DateCreated = $projectInfo['DateCreated'];
$DateCompleted = $projectInfo['DateCompleted'];
$Creator = $projectInfo['Creator'];
$CurrentSprint = $projectInfo['CurrentSprint'];
$SprintDuration = $projectInfo['SprintDuration'];
$dataSource = new MySQLDataSource('2013teamb', '2013teamb', '29G8l!06J82ofpPw', 'devdb.fulgentcorp.com');
$dataSource->setSQLSource("Sprint");
$sprintRange = new ChartComponent();
$sprintRange->setCaption("Sprint Metrics");
$sprintRange->setDataSource($dataSource);
$sprintRange->addCondition("Sprint.ProjectID", "==", "{$ProjectID}");
//$sprintRange->setLabelExpression("Sprint", "Sprint.SprintNum");
$sprintRange->setLabelExpression("Day", "Sprint.FinishTime", array('timestampRange' => 'time', 'timeUnit' => 'day', 'customTimeUnitPath' => array('year', 'month', 'day'), 'autoDrill' => true));
//$sprintRange->setYAxis("Day");
$sprintRange->addSeries("Day", "SprintNum");
//$sprintRange->setOption('limit', 10);
Dashboard::addComponent($sprintRange);
$itemSource = new MySQLDataSource('2013teamb', '2013teamb', '29G8l!06J82ofpPw', 'devdb.fulgentcorp.com');
$itemSource->setSQLSource("Item");
$itemRange = new ChartComponent();
$itemRange->setCaption("Item Metrics");
$itemRange->setDataSource($itemSource);
$itemRange->addCondition("Item.ProjectID", "==", "{$ProjectID}");
$itemRange->setLabelExpression("Name", "Item.ItemName");
$itemRange->addSeries("Item", "Item.Priority");
Dashboard::addComponent($itemRange);
Dashboard::Render();
示例3: TableComponent
$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);
// Link the artist chart to the yearly sales gauge
$artistSales->autoLink($yearlySalesGauge);
Dashboard::Render();