Skip to content
Extraits de code Groupes Projets
Valider bb0e02d2 rédigé par Thomas Steur's avatar Thomas Steur
Parcourir les fichiers

refs #1816 display tooltip which explains percentage value in detail

parent 4793bc77
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -21,7 +21,16 @@ ...@@ -21,7 +21,16 @@
{% endif %} {% endif %}
{% if row.getMetadata(tooltipIndex) %}</span>{% endif %} {% if row.getMetadata(tooltipIndex) %}</span>{% endif %}
{% set totals = dataTable.getMetadata('totals') %} {% set totals = dataTable.getMetadata('totals') %}
{% if column in totals|keys and totals[column] -%} {% if column in totals|keys -%}
<span class="ratio">&nbsp;{{ row.getColumn(column)|percentage(totals[column], 1) }}</span> {% set rowPercentage = row.getColumn(column)|percentage(totals[column], 1) %}
{% set totalValue = siteSummary.getFirstRow.getColumn(column) %}
{% if totalValue %}
{% set totalPercentage = row.getColumn(column)|percentage(totalValue, 1) %}
{% set secondPartOfTooltip = ['This is ', totalPercentage, ' of all ', totalValue, ' ', translations[column]|default(column)]|join %}
{% else %}
{% set secondPartOfTooltip = '' %}
{% endif %}
<span class="ratio" title="'{{ row.getColumn(columns_to_display|first)|e('html_attr') }}' represents {{ rowPercentage|e('html_attr') }} of {{ totals[column]|e('html_attr') }} with {{ translations[columns_to_display|first]|default(columns_to_display|first)|e('html_attr') }}. {{ secondPartOfTooltip }}">&nbsp;{{ rowPercentage }}</span>
{%- endif %} {%- endif %}
{% endspaceless %} {% endspaceless %}
...@@ -12,6 +12,9 @@ namespace Piwik\Plugins\CoreVisualizations\Visualizations; ...@@ -12,6 +12,9 @@ namespace Piwik\Plugins\CoreVisualizations\Visualizations;
use Piwik\Plugin\Visualization; use Piwik\Plugin\Visualization;
use Piwik\View; use Piwik\View;
use Piwik\Common;
use Piwik\Period;
use Piwik\API\Request as ApiRequest;
/** /**
* DataTable visualization that shows DataTable data in an HTML table. * DataTable visualization that shows DataTable data in an HTML table.
...@@ -42,6 +45,16 @@ class HtmlTable extends Visualization ...@@ -42,6 +45,16 @@ class HtmlTable extends Visualization
$this->config->show_visualization_only = true; $this->config->show_visualization_only = true;
} }
// we do not want to get a datatable\map
$period = Common::getRequestVar('period', 'day', 'string');
if (Period\Range::parseDateRange($period)) {
$period = 'range';
}
$request = new ApiRequest(array('method' => 'API.get', 'module' => 'API', 'format' => 'original', 'period' => $period));
$this->assignTemplateVar('siteSummary', $request->process());
} }
} }
\ No newline at end of file
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter