Skip to content

Commit

Permalink
fixes matomo-org#4375 fix total is not available in records to plot i…
Browse files Browse the repository at this point in the history
…f enabled
  • Loading branch information
tsteur committed Jan 24, 2014
1 parent ea0917e commit 18cb11c
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions plugins/CoreVisualizations/Visualizations/Graph.php
Expand Up @@ -86,24 +86,28 @@ public function determineWhichRowsAreSelectable()
continue;
}

// determine whether row is visible
$isVisible = true;
if ('label' == $self->config->row_picker_match_rows_by) {
$isVisible = in_array($rowLabel, $self->config->rows_to_display);
}

// build config
if (!isset($self->selectableRows[$rowLabel])) {
$self->selectableRows[$rowLabel] = array(
'label' => $rowLabel,
'matcher' => $rowLabel,
'displayed' => $isVisible
'displayed' => $self->isRowVisible($rowLabel)
);
}
}
});
}

public function isRowVisible($rowLabel)
{
$isVisible = true;
if ('label' == $this->config->row_picker_match_rows_by) {
$isVisible = in_array($rowLabel, $this->config->rows_to_display);
}

return $isVisible;
}

/**
* Defaults the selectable_columns property if it has not been set and then transforms
* it into something the SeriesPicker JavaScript class can use.
Expand All @@ -114,6 +118,15 @@ public function afterAllFiltersAreApplied()

$this->config->selectable_rows = array_values($this->selectableRows);

if ($this->config->add_total_row) {
$totalTranslation = Piwik::translate('General_Total');
$this->config->selectable_rows[] = array(
'label' => $totalTranslation,
'matcher' => $totalTranslation,
'displayed' => $this->isRowVisible($totalTranslation)
);
}

if ($this->config->show_goals) {
$this->config->addTranslations(array(
'nb_conversions' => Piwik::translate('Goals_ColumnConversions'),
Expand Down Expand Up @@ -143,4 +156,4 @@ public function afterAllFiltersAreApplied()

$this->config->selectable_columns = $transformed;
}
}
}

0 comments on commit 18cb11c

Please sign in to comment.