Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiosmosis <benakamoorthi@fastmail.fm>2013-11-14 15:23:53 +0400
committerdiosmosis <benakamoorthi@fastmail.fm>2013-11-14 15:24:08 +0400
commit65e9317a7af0486f80e9651546e429941975fc48 (patch)
tree7dd524586b983ef4325d6a5fd33665aff044bf11 /plugins/CoreHome/DataTableRowAction/RowEvolution.php
parentc5a8419aa96050b58281720061f979ca09647fbc (diff)
Use first and last values in metric details in row evolution and show min/max as tooltip. Includes tweaks to translations.
Diffstat (limited to 'plugins/CoreHome/DataTableRowAction/RowEvolution.php')
-rw-r--r--plugins/CoreHome/DataTableRowAction/RowEvolution.php43
1 files changed, 35 insertions, 8 deletions
diff --git a/plugins/CoreHome/DataTableRowAction/RowEvolution.php b/plugins/CoreHome/DataTableRowAction/RowEvolution.php
index 13b63610db..188d4c61fe 100644
--- a/plugins/CoreHome/DataTableRowAction/RowEvolution.php
+++ b/plugins/CoreHome/DataTableRowAction/RowEvolution.php
@@ -223,15 +223,11 @@ class RowEvolution
$i = 0;
$metrics = array();
foreach ($this->availableMetrics as $metric => $metricData) {
- $max = isset($metricData['max']) ? $metricData['max'] : 0;
- $min = isset($metricData['min']) ? $metricData['min'] : 0;
- $change = isset($metricData['change']) ? $metricData['change'] : false;
-
$unit = Metrics::getUnit($metric, $this->idSite);
- $min .= $unit;
- $max .= $unit;
+ $change = isset($metricData['change']) ? $metricData['change'] : false;
- $details = Piwik::translate('RowEvolution_MetricBetweenText', array($min, $max));
+ list($first, $last) = $this->getFirstAndLastDataPointsForMetric($metric);
+ $details = Piwik::translate('RowEvolution_MetricBetweenText', array($first, $last));
if ($change !== false) {
$lowerIsBetter = Metrics::isLowerValueBetter($metric);
@@ -253,9 +249,17 @@ class RowEvolution
$details .= ', ' . Piwik::translate('RowEvolution_MetricChangeText', $change);
}
+ // set metric min/max text (used as tooltip for details)
+ $max = isset($metricData['max']) ? $metricData['max'] : 0;
+ $min = isset($metricData['min']) ? $metricData['min'] : 0;
+ $min .= $unit;
+ $max .= $unit;
+ $minmax = Piwik::translate('RowEvolution_MetricMinMax', array($metricData['name'], $min, $max));
+
$newMetric = array(
'label' => $metricData['name'],
'details' => $details,
+ 'minmax' => $minmax,
'sparkline' => $this->getSparkline($metric),
);
// Multi Rows, each metric can be for a particular row and display an icon
@@ -293,4 +297,27 @@ class RowEvolution
{
$this->graphMetrics = $this->availableMetrics;
}
-}
+
+ private function getFirstAndLastDataPointsForMetric($metric)
+ {
+ $first = 0;
+ $firstTable = $this->dataTable->getFirstRow();
+ if (!empty($firstTable)) {
+ $row = $firstTable->getFirstRow();
+ if (!empty($row)) {
+ $first = floatval($row->getColumn($metric));
+ }
+ }
+
+ $last = 0;
+ $lastTable = $this->dataTable->getLastRow();
+ if (!empty($lastTable)) {
+ $row = $lastTable->getFirstRow();
+ if (!empty($row)) {
+ $last = floatval($row->getColumn($metric));
+ }
+ }
+
+ return array($first, $last);
+ }
+} \ No newline at end of file