summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2016-05-17 15:09:23 +0200
committerNicolas Martinelli <nim@odoo.com>2016-05-17 16:38:28 +0200
commit68b127797e717ee71b5b0552d69f0f4b4e083f03 (patch)
treeb34eaf1782c80ba9e0b497401d3e810e1493ea87 /addons/web/static/src
parentcab2dce0d2a05d800027553e2919dfd75dda8b5d (diff)
[FIX] web: left margin of graph
The left margin of the graph doesn't take into account the width of the maximum Y-axis value. In case the values are high (> 10^7), they are cropped. The fix is to adapt the left margin as a function of the size of the maximum value. opw-676538
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/views/graph_widget.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views/graph_widget.js b/addons/web/static/src/js/views/graph_widget.js
index 048838ad9cd..e458cc483ed 100644
--- a/addons/web/static/src/js/views/graph_widget.js
+++ b/addons/web/static/src/js/views/graph_widget.js
@@ -162,7 +162,9 @@ return Widget.extend({
svg.transition().duration(0);
var chart = nv.models.multiBarChart();
+ var maxVal = _.max(values, function(v) {return v.y})
chart.options({
+ margin: {left: 12 * String(maxVal && maxVal.y || 0).length},
delay: 250,
transition: 10,
showLegend: _.size(data) <= MAX_LEGEND_LENGTH,
@@ -292,8 +294,9 @@ return Widget.extend({
svg.transition().duration(0);
var chart = nv.models.lineChart();
+ var maxVal = _.max(values, function(v) {return v.y})
chart.options({
- margin: {left: 50, right: 50},
+ margin: {left: 12 * String(maxVal && maxVal.y || 0).length, right: 50},
useInteractiveGuideline: true,
showLegend: _.size(data) <= MAX_LEGEND_LENGTH,
showXAxis: true,