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