Skip to content
Extraits de code Groupes Projets
Valider 9580e8f7 rédigé par Fabian Becker's avatar Fabian Becker
Parcourir les fichiers

Merge branch 'master' of https://github.com/piwik/piwik

parents c072a0e5 61e01096
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -82,14 +82,14 @@ class DataTableGenericFilter
'filter_sort_column' => array('string'),
'filter_sort_order' => array('string', 'desc'),
),
'Truncate' => array(
'filter_truncate' => array('integer'),
),
'Limit' => array(
'filter_offset' => array('integer', '0'),
'filter_limit' => array('integer'),
'keep_summary_row' => array('integer', '0'),
),
'Truncate' => array(
'filter_truncate' => array('integer'),
),
);
}
......
......@@ -40,7 +40,7 @@ class API
* @param int|bool $show_evolution_values Whether to calculate evolution values for each row or not.
* @return array
*/
public function getTreemapData($apiMethod, $column, $period, $date, $show_evolution_values = false)
public function getTreemapData($apiMethod, $column, $period, $date, $truncateAfter = false, $show_evolution_values = false)
{
if ($period == 'range') {
$show_evolution_values = false;
......@@ -65,6 +65,12 @@ class API
if ($show_evolution_values) {
$generator->showEvolutionValues();
}
$truncateAfter = (int)$truncateAfter;
if ($truncateAfter > 0) {
$generator->setTruncateAfter($truncateAfter);
}
return $generator->generate($dataTable);
}
}
\ No newline at end of file
......@@ -134,6 +134,11 @@ class Treemap extends Graph
$generator->showEvolutionValues();
}
$truncateAfter = Common::getRequestVar('truncateAfter', false, 'int');
if ($truncateAfter > 0) {
$generator->setTruncateAfter($truncateAfter);
}
return Common::json_encode($generator->generate($dataTable));
}
......
......@@ -64,6 +64,14 @@ class TreemapDataGenerator
*/
private $showEvolutionValues = false;
/**
* The row offset to apply an additional truncation to (the first truncation occurs in
* DataTableGenericFilter).
*
* @var int
*/
private $truncateAfter = false;
/**
* Constructor.
*
......@@ -104,6 +112,16 @@ class TreemapDataGenerator
$this->showEvolutionValues = true;
}
/**
* Sets the row offset to apply additional truncation after.
*
* @param int $truncateAfter
*/
public function setTruncateAfter($truncateAfter)
{
$this->truncateAfter = $truncateAfter;
}
/**
* Generates an array that can be encoded as JSON and used w/ the JavaScript Infovis Toolkit.
*
......@@ -112,6 +130,11 @@ class TreemapDataGenerator
*/
public function generate($dataTable)
{
// handle extra truncation
if ($this->truncateAfter) {
$dataTable->filter('Truncate', array($this->truncateAfter));
}
// if showEvolutionValues is true, $dataTable must be a DataTable\Map w/ two child tables
$pastData = false;
if ($this->showEvolutionValues) {
......
......@@ -430,7 +430,7 @@
apiMethod: this.param.module + '.' + this.param.action, // TODO: will this work for all subtables?
format: 'json',
column: this.param.columns,
filter_truncate: this.props.max_graph_elements - 1,
truncateAfter: this.props.max_graph_elements - 1,
filter_limit: -1,
expanded: 1,
depth: this.props.depth || 1,
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter