Skip to content
Snippets Groups Projects
Commit f00e9c64 authored by Mitali Patel's avatar Mitali Patel Committed by Denis Vermylen
Browse files

[IMP] web: custom tooltip in dashboard graph widget

parent 15134aa1
No related branches found
No related tags found
No related merge requests found
......@@ -1801,6 +1801,13 @@ var JournalDashboardGraph = AbstractField.extend({
});
self.chart.yAxis.tickFormat(d3.format(',.2f'));
self.chart.tooltip.contentGenerator(function (key) {
return qweb.render('GraphCustomTooltip', {
'color': key.point.color,
'key': self.data[0].key,
'value': d3.format(',.2f')(key.point.y)
});
});
break;
case "bar":
......@@ -1816,6 +1823,13 @@ var JournalDashboardGraph = AbstractField.extend({
self.chart.xAxis.axisLabel(self.data[0].title);
self.chart.yAxis.tickFormat(d3.format(',.2f'));
self.chart.tooltip.contentGenerator(function (key) {
return qweb.render('GraphCustomTooltip', {
'color': key.color,
'key': self.data[0].key,
'value': d3.format(',.2f')(key.data.value)
});
});
break;
}
d3.select(self.$('svg')[0])
......
......@@ -74,4 +74,17 @@
</div>
</t>
<t t-name="GraphCustomTooltip">
<table>
<tbody>
<tr>
<td class="legend-color-guide">
<div t-attf-style="background-color: #{color};"></div>
</td>
<td class="key"><t t-esc="key" /></td>
<td class="value"><t t-esc="value" /></td>
</tr>
</tbody>
</table>
</t>
</template>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment