forked from remp2020/crm-application-module
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SmallBarGraph.php
42 lines (35 loc) · 970 Bytes
/
SmallBarGraph.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace Crm\ApplicationModule\Components\Graphs;
/**
* Bar graph
*
* Component for rendering very simple bar graphs.
*
* @package Crm\ApplicationModule\Components\Graphs
*/
class SmallBarGraph extends BaseGraphControl
{
private $view = 'small_bar_graph';
private $graphTitle = '[Názov grafu]';
public function setGraphTitle($graphTitle)
{
$this->graphTitle = $graphTitle;
return $this;
}
public function addSerie($data)
{
$this->series = $data;
return $this;
}
public function render()
{
$this->template->graphId = $this->generateGraphId();
$this->template->graphTitle = $this->graphTitle;
$this->template->data = array_pop($this->series);
if ($this->template->data == null) {
$this->template->data = [];
}
$this->template->setFile(__DIR__ . '/' . $this->view . '.latte');
$this->template->render();
}
}