@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final 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}