summaryrefslogtreecommitdiff
path: root/addons/web/static/src/xml/chart.xml
diff options
context:
space:
mode:
authorJuhil Somaiya <jso@odoo.com>2018-12-19 12:17:19 +0000
committerMathieu Duckerts-Antoine <dam@odoo.com>2019-02-25 08:26:10 +0000
commitb3b29f3b86f22b3157aba35e66e8ec3c16ee47bc (patch)
tree7a5f638d22ff84f54124bc03819141425cc343d2 /addons/web/static/src/xml/chart.xml
parent23dcaf4836915b9d23a55b712746d159c19fa15d (diff)
[IMP] web: graph view legend and tooltips improvements
This commit ameliorates the tooltips and the legend of the graph view in its different modes (bar, line, and pie). Related task id: 1917940 Co-authored-by: Mohammed Shekha <msh@openerp.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> closes odoo/odoo#29747
Diffstat (limited to 'addons/web/static/src/xml/chart.xml')
-rw-r--r--addons/web/static/src/xml/chart.xml39
1 files changed, 39 insertions, 0 deletions
diff --git a/addons/web/static/src/xml/chart.xml b/addons/web/static/src/xml/chart.xml
new file mode 100644
index 00000000000..a6f5cccc712
--- /dev/null
+++ b/addons/web/static/src/xml/chart.xml
@@ -0,0 +1,39 @@
+<template>
+
+<t t-name="web.PieChart">
+ <graph type="pie" t-att-title="title">
+ <field t-att-name="modifiers.groupby.split(':')[0]" t-att-interval="modifiers.groupby.split(':')[1]"/>
+ <field t-if="modifiers.measure" t-att-name="modifiers.measure" type="measure"/>
+ </graph>
+</t>
+
+<t t-name="web.Chart.Tooltip">
+ <table>
+ <thead>
+ <tr>
+ <td colspan="3">
+ <strong class="x-value">
+ <t t-esc="title"/>
+ </strong>
+ </td>
+ </tr>
+ </thead>
+ <tbody>
+ <t t-foreach="lines" t-as="line">
+ <tr>
+ <td class="legend-color-guide">
+ <div t-att-style="'background-color:' + line.color +';'"/>
+ </td>
+ <td class="key">
+ <t t-esc="line.label"/>
+ </td>
+ <td class="value">
+ <t t-esc="line.value &amp;&amp; window.parseFloat(line.value).toFixed(2) || 0"/>
+ </td>
+ </tr>
+ </t>
+ </tbody>
+ </table>
+</t>
+
+</template>