pluginName . '.' . __FUNCTION__; $apiAction = 'ExampleUI.getTemperatures'; $view = ViewDataTableFactory::build('table', $apiAction, $controllerAction); $view->config->translations['value'] = 'Temperature in °C'; $view->config->translations['label'] = 'Hour of day'; $view->requestConfig->filter_sort_column = 'label'; $view->requestConfig->filter_sort_order = 'asc'; $view->requestConfig->filter_limit = 24; $view->config->columns_to_display = array('label', 'value'); $view->config->y_axis_unit = '°C'; // useful if the user requests the bar graph $view->config->show_exclude_low_population = false; $view->config->show_table_all_columns = false; $view->config->disable_row_evolution = true; $view->config->max_graph_elements = 24; $view->config->metrics_documentation = array('value' => 'Documentation for temperature metric'); echo $view->render(); } public function evolutionGraph() { $view = new View('@ExampleUI/evolutiongraph'); $this->setPeriodVariablesView($view); $view->evolutionGraph = $this->getEvolutionGraph(true, array('server1', 'server2')); echo $view->render(); } public function notifications() { $notification = new Notification('Lorem ipsum dolor sit amet, consectetur adipiscing elit.'); Notification\Manager::notify('ExampleUI_InfoSimple', $notification); $notification = new Notification('Neque porro quisquam est qui dolorem ipsum quia dolor sit amet.'); $notification->title = 'Warning:'; $notification->context = Notification::CONTEXT_WARNING; $notification->flags = null; Notification\Manager::notify('ExampleUI_warningWithClose', $notification); $notification = new Notification('Phasellus tincidunt arcu at justo faucibus, et lacinia est accumsan. '); $notification->title = 'Well done'; $notification->context = Notification::CONTEXT_SUCCESS; $notification->type = Notification::TYPE_TOAST; Notification\Manager::notify('ExampleUI_successToast', $notification); $notification = new Notification('Phasellus tincidunt arcu at justo faucibus, et lacinia est accumsan. '); $notification->raw = true; $notification->context = Notification::CONTEXT_ERROR; Notification\Manager::notify('ExampleUI_error', $notification); $view = new View('@ExampleUI/notifications'); $this->setGeneralVariablesView($view); echo $view->render(); } public function getEvolutionGraph($fetch = false, array $columns = array()) { if (empty($columns)) { $columns = Common::getRequestVar('columns'); $columns = Piwik::getArrayFromApiParameter($columns); } $view = $this->getLastUnitGraphAcrossPlugins($this->pluginName, __FUNCTION__, $columns, $selectableColumns = array('server1', 'server2'), 'My documentation', 'ExampleUI.getTemperaturesEvolution'); $view->requestConfig->filter_sort_column = 'label'; return $this->renderView($view, $fetch); } public function barGraph() { $view = ViewDataTableFactory::build( 'graphVerticalBar', 'ExampleUI.getTemperatures', $controllerAction = 'ExampleUI.barGraph'); $view->config->y_axis_unit = '°C'; $view->config->show_footer = false; $view->config->translations['value'] = "Temperature"; $view->config->selectable_columns = array("value"); $view->config->max_graph_elements = 24; echo $view->render(); } public function pieGraph() { $view = ViewDataTableFactory::build( 'graphPie', 'ExampleUI.getPlanetRatios', $controllerAction = 'ExampleUI.pieGraph'); $view->config->columns_to_display = array('value'); $view->config->translations['value'] = "times the diameter of Earth"; $view->config->show_footer_icons = false; $view->config->selectable_columns = array("value"); $view->config->max_graph_elements = 10; echo $view->render(); } public function tagClouds() { echo "