summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2016-12-22 11:23:35 +0100
committerNicolas Martinelli <nim@odoo.com>2016-12-22 11:25:59 +0100
commita67ba328d78312e3e75296ba8c7208e6308deaba (patch)
tree51bdb488d1b6b314db8f261f27abe2895ba1cad1 /addons/web/static/src
parent2455e17842e9d5114bb3e2aa161e2afa54106a34 (diff)
[FIX] web: y-axis precision
In graph view, the y-axis always uses the standard float precision with 2 digits. This might not be enough if the precision was defined differently for a given float type. opw-697625
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/views/graph_widget.js17
1 files changed, 14 insertions, 3 deletions
diff --git a/addons/web/static/src/js/views/graph_widget.js b/addons/web/static/src/js/views/graph_widget.js
index 7c9c62700de..183d99047c9 100644
--- a/addons/web/static/src/js/views/graph_widget.js
+++ b/addons/web/static/src/js/views/graph_widget.js
@@ -107,7 +107,8 @@ return Widget.extend({
display_bar: function () {
// prepare data for bar chart
var data, values,
- measure = this.fields[this.measure].string;
+ measure = this.fields[this.measure].string,
+ self = this;
// zero groupbys
if (this.groupbys.length === 0) {
@@ -180,7 +181,12 @@ return Widget.extend({
rotateLabels: -20,
showControls: (this.groupbys.length > 1)
});
- chart.yAxis.tickFormat(function(d) { return formats.format_value(d, { type : 'float' });});
+ chart.yAxis.tickFormat(function(d) {
+ return formats.format_value(d, {
+ type : 'float',
+ digits : self.fields[self.measure] && self.fields[self.measure].digits || [69, 2],
+ });
+ });
chart(svg);
this.to_remove = chart.update;
@@ -312,7 +318,12 @@ return Widget.extend({
});
chart.xAxis.tickValues(tickValues)
.tickFormat(tickFormat);
- chart.yAxis.tickFormat(function(d) { return formats.format_value(d, { type : 'float' });});
+ chart.yAxis.tickFormat(function(d) {
+ return formats.format_value(d, {
+ type : 'float',
+ digits : self.fields[self.measure] && self.fields[self.measure].digits || [69, 2],
+ });
+ });
chart(svg);
this.to_remove = chart.update;