Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs #3994 this is an example how to make a customized existing visua…
…lization reusable
- Loading branch information
Showing
2 changed files
with
52 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
/** | ||
* Piwik - Open source web analytics | ||
* | ||
* @link http://piwik.org | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | ||
* | ||
* @category Piwik_Plugins | ||
* @package ExampleUI | ||
*/ | ||
|
||
namespace Piwik\Plugins\ExampleUI; | ||
|
||
use Piwik\ViewDataTable; | ||
|
||
class CustomDataTable | ||
{ | ||
public function render($value, $label, $apiAction, $controllerAction) | ||
{ | ||
$view = ViewDataTable::factory('exampleui-customtable', $apiAction, $controllerAction); | ||
|
||
$view->translations['value'] = $value; | ||
$view->translations['label'] = $label; | ||
$view->filter_sort_column = 'label'; | ||
$view->filter_sort_order = 'asc'; | ||
$view->filter_limit = 24; | ||
$view->y_axis_unit = '°C'; // useful if the user requests the bar graph | ||
$view->show_exclude_low_population = false; | ||
$view->show_table_all_columns = false; | ||
$view->visualization_properties->setForVisualization( | ||
'Piwik\\Plugins\\CoreVisualizations\\Visualizations\\HtmlTable', | ||
'disable_row_evolution', | ||
true | ||
); | ||
$view->visualization_properties->setForVisualization( | ||
'Piwik\\Plugins\\CoreVisualizations\\Visualizations\\JqplotGraph', | ||
'max_graph_elements', | ||
24 | ||
); | ||
|
||
return $view->render(); | ||
} | ||
|
||
} |