3 final class PhabricatorProjectBurndownChartEngine
4 extends PhabricatorChartEngine
{
6 const CHARTENGINEKEY
= 'project.burndown';
8 public function setProjects(array $projects) {
9 assert_instances_of($projects, 'PhabricatorProject');
10 $project_phids = mpull($projects, 'getPHID');
11 return $this->setEngineParameter('projectPHIDs', $project_phids);
14 protected function newChart(PhabricatorFactChart
$chart, array $map) {
15 $viewer = $this->getViewer();
18 'projectPHIDs' => array(),
21 if ($map['projectPHIDs']) {
22 $projects = id(new PhabricatorProjectQuery())
24 ->withPHIDs($map['projectPHIDs'])
26 $project_phids = mpull($projects, 'getPHID');
28 $project_phids = array();
33 $open_function = $this->newFunction(
39 'tasks.open-count.create.project', $project_phids),
41 'tasks.open-count.status.project', $project_phids),
43 'tasks.open-count.assign.project', $project_phids),
47 $closed_function = $this->newFunction(
50 $this->newFactSum('tasks.open-count.status.project', $project_phids),
53 $open_function = $this->newFunction(
58 array('fact', 'tasks.open-count.create'),
59 array('fact', 'tasks.open-count.status'),
63 $closed_function = $this->newFunction(
66 array('fact', 'tasks.open-count.status'),
70 $open_function->getFunctionLabel()
72 ->setName(pht('Open Tasks'))
73 ->setColor('rgba(0, 0, 200, 1)')
74 ->setFillColor('rgba(0, 0, 200, 0.15)');
76 $closed_function->getFunctionLabel()
78 ->setName(pht('Closed Tasks'))
79 ->setColor('rgba(0, 200, 0, 1)')
80 ->setFillColor('rgba(0, 200, 0, 0.15)');
84 $dataset = id(new PhabricatorChartStackedAreaDataset())
96 $datasets[] = $dataset;
97 $chart->attachDatasets($datasets);
100 private function newFactSum($fact_key, array $phids) {
104 foreach ($phids as $phid) {
105 $result[] = array('fact', $fact_key, $phid);