Differential D20818 Diff 49637 src/applications/project/chart/PhabricatorProjectBurndownChartEngine.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/chart/PhabricatorProjectBurndownChartEngine.php
Show All 23 Lines | if ($map['projectPHIDs']) { | ||||
->withPHIDs($map['projectPHIDs']) | ->withPHIDs($map['projectPHIDs']) | ||||
->execute(); | ->execute(); | ||||
$project_phids = mpull($projects, 'getPHID'); | $project_phids = mpull($projects, 'getPHID'); | ||||
} else { | } else { | ||||
$project_phids = array(); | $project_phids = array(); | ||||
} | } | ||||
$functions = array(); | $functions = array(); | ||||
$stacks = array(); | |||||
if ($project_phids) { | if ($project_phids) { | ||||
foreach ($project_phids as $project_phid) { | foreach ($project_phids as $project_phid) { | ||||
$function = $this->newFunction( | $function = $this->newFunction( | ||||
array( | array( | ||||
'accumulate', | 'accumulate', | ||||
array( | array( | ||||
'compose', | 'compose', | ||||
array('fact', 'tasks.open-count.assign.project', $project_phid), | array('fact', 'tasks.open-count.assign.project', $project_phid), | ||||
array('min', 0), | array('min', 0), | ||||
), | ), | ||||
)); | )); | ||||
$function->getFunctionLabel() | $function->getFunctionLabel() | ||||
->setKey('moved-in') | |||||
->setName(pht('Tasks Moved Into Project')) | ->setName(pht('Tasks Moved Into Project')) | ||||
->setColor('rgba(128, 128, 200, 1)') | ->setColor('rgba(128, 128, 200, 1)') | ||||
->setFillColor('rgba(128, 128, 200, 0.15)'); | ->setFillColor('rgba(128, 128, 200, 0.15)'); | ||||
$functions[] = $function; | $functions[] = $function; | ||||
$function = $this->newFunction( | $function = $this->newFunction( | ||||
array( | array( | ||||
'accumulate', | 'accumulate', | ||||
array( | |||||
'compose', | |||||
array('fact', 'tasks.open-count.status.project', $project_phid), | |||||
array('min', 0), | |||||
), | |||||
)); | |||||
$function->getFunctionLabel() | |||||
->setKey('reopened') | |||||
->setName(pht('Tasks Reopened')) | |||||
->setColor('rgba(128, 128, 200, 1)') | |||||
->setFillColor('rgba(128, 128, 200, 0.15)'); | |||||
$functions[] = $function; | |||||
$function = $this->newFunction( | |||||
array( | |||||
'accumulate', | |||||
array('fact', 'tasks.open-count.create.project', $project_phid), | array('fact', 'tasks.open-count.create.project', $project_phid), | ||||
)); | )); | ||||
$function->getFunctionLabel() | $function->getFunctionLabel() | ||||
->setKey('created') | |||||
->setName(pht('Tasks Created')) | ->setName(pht('Tasks Created')) | ||||
->setColor('rgba(0, 0, 200, 1)') | ->setColor('rgba(0, 0, 200, 1)') | ||||
->setFillColor('rgba(0, 0, 200, 0.15)'); | ->setFillColor('rgba(0, 0, 200, 0.15)'); | ||||
$functions[] = $function; | $functions[] = $function; | ||||
$function = $this->newFunction( | $function = $this->newFunction( | ||||
array( | array( | ||||
'accumulate', | 'accumulate', | ||||
array( | array( | ||||
'compose', | 'compose', | ||||
array('fact', 'tasks.open-count.assign.project', $project_phid), | array('fact', 'tasks.open-count.status.project', $project_phid), | ||||
array('max', 0), | array('max', 0), | ||||
), | ), | ||||
)); | )); | ||||
$function->getFunctionLabel() | $function->getFunctionLabel() | ||||
->setName(pht('Tasks Moved Out of Project')) | ->setKey('closed') | ||||
->setColor('rgba(128, 200, 128, 1)') | ->setName(pht('Tasks Closed')) | ||||
->setFillColor('rgba(128, 200, 128, 0.15)'); | ->setColor('rgba(0, 200, 0, 1)') | ||||
->setFillColor('rgba(0, 200, 0, 0.15)'); | |||||
$functions[] = $function; | $functions[] = $function; | ||||
$function = $this->newFunction( | $function = $this->newFunction( | ||||
array( | array( | ||||
'accumulate', | 'accumulate', | ||||
array('fact', 'tasks.open-count.status.project', $project_phid), | array( | ||||
'compose', | |||||
array('fact', 'tasks.open-count.assign.project', $project_phid), | |||||
array('max', 0), | |||||
), | |||||
)); | )); | ||||
$function->getFunctionLabel() | $function->getFunctionLabel() | ||||
->setName(pht('Tasks Closed')) | ->setKey('moved-out') | ||||
->setColor('rgba(0, 200, 0, 1)') | ->setName(pht('Tasks Moved Out of Project')) | ||||
->setFillColor('rgba(0, 200, 0, 0.15)'); | ->setColor('rgba(128, 200, 128, 1)') | ||||
->setFillColor('rgba(128, 200, 128, 0.15)'); | |||||
$functions[] = $function; | $functions[] = $function; | ||||
$stacks[] = array('created', 'reopened', 'moved-in'); | |||||
$stacks[] = array('closed', 'moved-out'); | |||||
} | } | ||||
} else { | } else { | ||||
$function = $this->newFunction( | $function = $this->newFunction( | ||||
array( | array( | ||||
'accumulate', | 'accumulate', | ||||
array('fact', 'tasks.open-count.create'), | array('fact', 'tasks.open-count.create'), | ||||
)); | )); | ||||
$function->getFunctionLabel() | $function->getFunctionLabel() | ||||
->setName(pht('Tasks Created')) | ->setKey('open') | ||||
->setName(pht('Open Tasks')) | |||||
->setColor('rgba(0, 0, 200, 1)') | ->setColor('rgba(0, 0, 200, 1)') | ||||
->setFillColor('rgba(0, 0, 200, 0.15)'); | ->setFillColor('rgba(0, 0, 200, 0.15)'); | ||||
$functions[] = $function; | $functions[] = $function; | ||||
$function = $this->newFunction( | $function = $this->newFunction( | ||||
array( | array( | ||||
'accumulate', | 'accumulate', | ||||
array('fact', 'tasks.open-count.status'), | array('fact', 'tasks.open-count.status'), | ||||
)); | )); | ||||
$function->getFunctionLabel() | $function->getFunctionLabel() | ||||
->setName(pht('Tasks Closed')) | ->setKey('closed') | ||||
->setName(pht('Closed Tasks')) | |||||
->setColor('rgba(0, 200, 0, 1)') | ->setColor('rgba(0, 200, 0, 1)') | ||||
->setFillColor('rgba(0, 200, 0, 0.15)'); | ->setFillColor('rgba(0, 200, 0, 0.15)'); | ||||
$functions[] = $function; | $functions[] = $function; | ||||
} | } | ||||
$datasets = array(); | $datasets = array(); | ||||
$datasets[] = id(new PhabricatorChartStackedAreaDataset()) | $dataset = id(new PhabricatorChartStackedAreaDataset()) | ||||
->setFunctions($functions); | ->setFunctions($functions); | ||||
if ($stacks) { | |||||
$dataset->setStacks($stacks); | |||||
} | |||||
$datasets[] = $dataset; | |||||
$chart->attachDatasets($datasets); | $chart->attachDatasets($datasets); | ||||
} | } | ||||
} | } |