Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/fact/engine/PhabricatorDemoChartEngine.php
12256 views
1
<?php
2
3
final class PhabricatorDemoChartEngine
4
extends PhabricatorChartEngine {
5
6
const CHARTENGINEKEY = 'facts.demo';
7
8
protected function newChart(PhabricatorFactChart $chart, array $map) {
9
$viewer = $this->getViewer();
10
11
$functions = array();
12
13
$function = $this->newFunction(
14
array('scale', 0.0001),
15
array('cos'),
16
array('scale', 128),
17
array('shift', 256));
18
19
$function->getFunctionLabel()
20
->setKey('cos-x')
21
->setName(pht('cos(x)'))
22
->setColor('rgba(0, 200, 0, 1)')
23
->setFillColor('rgba(0, 200, 0, 0.15)');
24
25
$functions[] = $function;
26
27
$function = $this->newFunction(
28
array('constant', 345));
29
30
$function->getFunctionLabel()
31
->setKey('constant-345')
32
->setName(pht('constant(345)'))
33
->setColor('rgba(0, 0, 200, 1)')
34
->setFillColor('rgba(0, 0, 200, 0.15)');
35
36
$functions[] = $function;
37
38
$datasets = array();
39
40
$datasets[] = id(new PhabricatorChartStackedAreaDataset())
41
->setFunctions($functions);
42
43
$chart->attachDatasets($datasets);
44
}
45
46
}
47
48