diff options
author | diosmosis <benaka@piwik.pro> | 2014-11-17 10:07:17 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2014-11-17 10:07:17 +0300 |
commit | 8676a94a9bc5544a759012520d0150a65fed6cc4 (patch) | |
tree | 8f06a141d9c9b9919f3de78627ec7ee5beccb1e8 /core/Plugin/Visualization.php | |
parent | c39566965b4b9371e619e11cb8346a9a11f8b246 (diff) |
Move format metrics logic from processor to Metrics\Formatter and fix Overlay UI tests by formatting manually w/ an Html Formatter.
Diffstat (limited to 'core/Plugin/Visualization.php')
-rw-r--r-- | core/Plugin/Visualization.php | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/core/Plugin/Visualization.php b/core/Plugin/Visualization.php index 91a79d2a58..d3e595dfd8 100644 --- a/core/Plugin/Visualization.php +++ b/core/Plugin/Visualization.php @@ -146,6 +146,11 @@ class Visualization extends ViewDataTable private $metadata = null; protected $metricsFormatter = null; + /** + * @var Report + */ + protected $report; + final public function __construct($controllerAction, $apiMethodToRequestDataTable, $params = array()) { $templateFile = static::TEMPLATE_FILE; @@ -157,6 +162,8 @@ class Visualization extends ViewDataTable $this->metricsFormatter = new HtmlFormatter(); parent::__construct($controllerAction, $apiMethodToRequestDataTable, $params); + + $this->report = Report::factory($this->requestConfig->getApiModuleToRequest(), $this->requestConfig->getApiMethodToRequest()); } protected function buildView() @@ -311,10 +318,9 @@ class Visualization extends ViewDataTable private function addVisualizationInfoFromMetricMetadata() { - $report = Report::factory($this->requestConfig->getApiModuleToRequest(), $this->requestConfig->getApiMethodToRequest()); $dataTable = $this->dataTable instanceof DataTable\Map ? $this->dataTable->getFirstRow() : $this->dataTable; - $processedMetrics = Report::getProcessedMetricsFor($dataTable, $report); + $processedMetrics = $this->metricsFormatter->getMetricsToFormat($dataTable, $this->report); // TODO: instead of iterating & calling translate everywhere, maybe we can get all translated names in one place. // may be difficult, though, since translated metrics are specific to the report. @@ -368,7 +374,7 @@ class Visualization extends ViewDataTable $this->dataTable->applyQueuedFilters(); } - $postProcessor->applyProcessedMetricsFormatting($this->dataTable, $this->metricsFormatter); + $this->metricsFormatter->formatMetrics($this->dataTable, $this->report); } private function removeEmptyColumnsFromDisplay() |