diff options
Diffstat (limited to 'plugins/CoreVisualizations/templates/_dataTableViz_htmlTable_ratio.twig')
-rw-r--r-- | plugins/CoreVisualizations/templates/_dataTableViz_htmlTable_ratio.twig | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/plugins/CoreVisualizations/templates/_dataTableViz_htmlTable_ratio.twig b/plugins/CoreVisualizations/templates/_dataTableViz_htmlTable_ratio.twig new file mode 100644 index 0000000000..8d14bb126d --- /dev/null +++ b/plugins/CoreVisualizations/templates/_dataTableViz_htmlTable_ratio.twig @@ -0,0 +1,26 @@ +{% if column in properties.report_ratio_columns and (column in totals|keys or forceZero|default) -%} + {% set reportTotal = totals[column]|default(0) %} + {% if siteTotalRow|default is not empty %} + {% set siteTotal = siteTotalRow.getColumn(column) %} + {% elseif siteSummary is defined and siteSummary is not empty and siteSummary.getFirstRow %} + {% set siteTotal = siteSummary.getFirstRow.getColumn(column) %} + {% else %} + {% set siteTotal = 0 %} + {% endif %} + + {% set rowPercentage = row.getColumn(column)|percentage(reportTotal, 1) %} + {% set metricTitle = translations[column]|default(column) %} + + {% set reportRatioTooltip = 'General_ReportRatioTooltip'|translate(label, rowPercentage|e('html_attr'), reportTotal|e('html_attr'), metricTitle|e('html_attr'), '"' ~ segmentTitlePretty ~ '"', translations[labelColumn]|default(labelColumn)|e('html_attr')) %} + + {% if siteTotal and siteTotal > reportTotal %} + {% set totalPercentage = row.getColumn(column)|percentage(siteTotal, 1) %} + {% set totalRatioTooltip = 'General_TotalRatioTooltip'|translate(totalPercentage, siteTotal|number(2,0), metricTitle, periodTitlePretty) %} + {% else %} + {% set totalRatioTooltip = '' %} + {% endif %} + + <span class="ratio" + title="{{ reportRatioTooltip|rawSafeDecoded|raw }} {{ totalRatioTooltip|rawSafeDecoded|e('html_attr') }}{% if tooltipSuffix|default is not empty %}<br/><br/> {{ tooltipSuffix|rawSafeDecoded|e('html_attr') }}{% endif %}" + > {{ rowPercentage }} {% if changePercantage|default is not empty %}({{ changePercentage }}){% endif %}</span> +{%- endif %} |