summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views
diff options
context:
space:
mode:
authorHiral Bhavsar <hbh@odoo.com>2018-12-24 13:37:59 +0000
committerMathieu Duckerts-Antoine <dam@odoo.com>2019-02-21 13:03:22 +0000
commitbb6aec1ac35fca2e7cb17ff1f194895fdd8021db (patch)
treeabed5a473726c44ad7205f673b5ed7dce2dd6530 /addons/web/static/src/js/views
parent4b652ebe8afe05ffdce709c5e85180a1f47d68c1 (diff)
[FIX] web: several columns in line chart tooltips for large data
Currently tooltip goes out off the screen when the graph view (in line mode) presents a large number of groups. The present commit splits the tooltip content in three columns when the number of groups exceeds 20. This split is not done in mobile mode because it is not an appropriate in that situation. Co-authored-by: Mohammed Shekha <msh@openerp.com> Related to Task: 1917958 closes odoo/odoo#30288
Diffstat (limited to 'addons/web/static/src/js/views')
-rw-r--r--addons/web/static/src/js/views/graph/graph_renderer.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views/graph/graph_renderer.js b/addons/web/static/src/js/views/graph/graph_renderer.js
index 2771159ab19..ca295119be6 100644
--- a/addons/web/static/src/js/views/graph/graph_renderer.js
+++ b/addons/web/static/src/js/views/graph/graph_renderer.js
@@ -21,6 +21,7 @@ var CHART_TYPES = ['pie', 'bar', 'line'];
// hide top legend when too many items for device size
var MAX_LEGEND_LENGTH = 25 * (Math.max(1, config.device.size_class));
+var SPLIT_THRESHOLD = config.device.isMobile ? Infinity : 20;
return AbstractRenderer.extend({
className: "o_graph_container",
@@ -412,7 +413,11 @@ return AbstractRenderer.extend({
}
}
- var $svgContainer = $('<div/>', {class: 'o_graph_svg_container'});
+ var $svgContainer = $('<div/>', { class: 'o_graph_svg_container'});
+ // Split the tooltip into columns for large data because some portion goes out off the screen.
+ if (data.length >= SPLIT_THRESHOLD) {
+ $svgContainer.addClass('o_tooltip_split_in_columns');
+ }
this.$el.append($svgContainer);
var svg = d3.select($svgContainer[0]).append('svg');
svg.datum(data);