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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
<?php
/**
* Piwik - Open source web analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
* @version $Id$
*
* @category Piwik
* @package Piwik
*/
/**
* Generates HTML embed for the Evolution graph
*
* @package Piwik
* @subpackage Piwik_ViewDataTable
*/
class Piwik_ViewDataTable_GenerateGraphHTML_ChartEvolution extends Piwik_ViewDataTable_GenerateGraphHTML
{
protected $height = 170;
protected $graphType = 'evolution';
protected function getViewDataTableId()
{
return 'graphEvolution';
}
protected function getViewDataTableIdToLoad()
{
return 'generateDataChartEvolution';
}
function init($currentControllerName,
$currentControllerAction,
$apiMethodToRequestDataTable,
$controllerActionCalledWhenRequestSubTable = null)
{
parent::init($currentControllerName,
$currentControllerAction,
$apiMethodToRequestDataTable,
$controllerActionCalledWhenRequestSubTable);
$this->setParametersToModify(array('date' => Piwik_Common::getRequestVar('date', 'last30', 'string')));
$this->disableShowAllViewsIcons();
$this->disableShowTable();
$this->disableShowAllColumns();
}
/**
* We ensure that the graph for a given Goal has a different ID than the 'Goals Overview' graph
* so that both can display on the dashboard at the same time
* @return null|string
*/
public function getUniqueIdViewDataTable()
{
$id = parent::getUniqueIdViewDataTable();
if (!empty($this->parametersToModify['idGoal']))
{
$id .= $this->parametersToModify['idGoal'];
}
return $id;
}
/**
* Sets the columns that will be displayed on output evolution chart
* By default all columns are displayed ($columnsNames = array() will display all columns)
*
* @param array $columnsNames Array of column names eg. array('nb_visits','nb_hits')
*/
public function setColumnsToDisplay($columnsNames)
{
if (!is_array($columnsNames))
{
if (strpos($columnsNames, ',') !== false)
{
// array values are comma separated
$columnsNames = explode(',', $columnsNames);
}
else
{
$columnsNames = array($columnsNames);
}
}
$this->setParametersToModify(array('columns' => $columnsNames));
}
}
|