Changeset View
Changeset View
Standalone View
Standalone View
src/applications/uiexample/examples/PHUIDataKitExample.php
- This file was added.
<?php | |||||
final class PHUIDataKitExample extends PhabricatorUIExample { | |||||
public function getName() { | |||||
return 'Data Kit'; | |||||
} | |||||
public function getDescription() { | |||||
return 'Make data pretty.'; | |||||
} | |||||
public function renderExample() { | |||||
$view = id(new AphrontMultiColumnView()) | |||||
->setFluidLayout(true) | |||||
->setBorder(true); | |||||
$users = array( | |||||
'Jan 1, 2014' => 1, | |||||
'Jan 2, 2014' => 2, | |||||
'Jan 3, 2014' => 3, | |||||
'Jan 4, 2014' => 4, | |||||
'Jan 5, 2014' => 5, | |||||
'Jan 6, 2014' => 6, | |||||
'Jan 7, 2014' => 7,); | |||||
$chart1 = id(new PHUIBarChartView()) | |||||
->setMinValue(0) | |||||
->setMaxValue(20) | |||||
->setUnit(pht('Users')) | |||||
->setBars($users); | |||||
$tasks = array( | |||||
'Jan 1, 2014' => 21, | |||||
'Jan 2, 2014' => 12, | |||||
'Jan 3, 2014' => 8, | |||||
'Jan 4, 2014' => 21, | |||||
'Jan 5, 2014' => 0, | |||||
'Jan 6, 2014' => 16, | |||||
'Jan 7, 2014' => 70,); | |||||
$chart2 = id(new PHUIBarChartView()) | |||||
->setMinValue(0) | |||||
->setMaxValue(50) | |||||
->setUnit(pht('Tasks')) | |||||
->setBars($tasks); | |||||
$commits = array( | |||||
'Jan 1, 2014' => 1, | |||||
'Jan 2, 2014' => 6, | |||||
'Jan 3, 2014' => 8, | |||||
'Jan 4, 2014' => 11, | |||||
'Jan 5, 2014' => 6, | |||||
'Jan 6, 2014' => 16, | |||||
'Jan 7, 2014' => 20,); | |||||
$chart3 = id(new PHUIBarChartView()) | |||||
->setMinValue(0) | |||||
->setMaxValue(100) | |||||
->setUnit(pht('Commits')) | |||||
->setBars($commits); | |||||
$funds = array( | |||||
'Jan 1, 2014' => '0.00', | |||||
'Jan 2, 2014' => '5.00', | |||||
'Jan 3, 2014' => '0.00', | |||||
'Jan 4, 2014' => '1.00', | |||||
'Jan 5, 2014' => '11.00', | |||||
'Jan 6, 2014' => '12.00', | |||||
'Jan 7, 2014' => '5.00',); | |||||
$chart4 = id(new PHUIBarChartView()) | |||||
->setMinValue(0) | |||||
->setMaxValue(100) | |||||
->setUnit(pht('Dollars')) | |||||
->setBars($funds); | |||||
$panel1 = id(new PHUIActionPanelView()) | |||||
->setChart($chart1) | |||||
->setHeader(pht('Daily Active Users')) | |||||
->setSubHeader( | |||||
pht('How many people come to work each day.')); | |||||
$view->addColumn($panel1); | |||||
$panel2 = id(new PHUIActionPanelView()) | |||||
->setChart($chart2) | |||||
->setHeader(pht('Daily Task Creation')) | |||||
->setSubHeader( | |||||
pht('How much are we over-extending ourselves.')); | |||||
$view->addColumn($panel2); | |||||
$panel3 = id(new PHUIActionPanelView()) | |||||
->setChart($chart3) | |||||
->setHeader(pht('Daily Commits')) | |||||
->setSubHeader( | |||||
pht('Obviously, the only correct metric for productivity.')); | |||||
$view->addColumn($panel3); | |||||
$panel4 = id(new PHUIActionPanelView()) | |||||
->setChart($chart4) | |||||
->setHeader(pht('Daily Funding')) | |||||
->setSubHeader( | |||||
pht('Can we afford health insurance at the end of the month.')); | |||||
$view->addColumn($panel4); | |||||
return phutil_tag_div('ml', $view); | |||||
} | |||||
} |