From 4b652ebe8afe05ffdce709c5e85180a1f47d68c1 Mon Sep 17 00:00:00 2001 From: Hiral Bhavsar Date: Mon, 17 Dec 2018 12:54:29 +0000 Subject: [PATCH] [IMP] web: properly display min and max abs when less that 3 abs. In graph line mode, min and max abs are displayed beyond the screen when there are less than 3 abs. This is happening because nvd3 fixes their text-anchor to 'middle'. The present commit fixes correctly their text-anchors to start and end respectively by using the '!important' rule (it seems difficult to do otherwise). Co-authored-by: Mohammed Shekha Related to Task: 1917958 --- addons/web/static/src/js/views/graph/graph_renderer.js | 4 ---- addons/web/static/src/scss/graph_view.scss | 8 ++++++++ 2 files changed, 8 insertions(+), 4 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 358426c86b9..2771159ab19 100644 --- a/addons/web/static/src/js/views/graph/graph_renderer.js +++ b/addons/web/static/src/js/views/graph/graph_renderer.js @@ -451,10 +451,6 @@ return AbstractRenderer.extend({ // of the tiny margins. if (ticksLabels.length > 3) { $svgContainer.find('svg .nv-x g.nv-axisMaxMin-x > text').hide(); - } else { - // Since the graph is on full container have first and last label in the container - $svgContainer.find('svg .nv-x g.nv-axisMin-x > text').css({'text-anchor': 'start'}); - $svgContainer.find('svg .nv-x g.nv-axisMax-x > text').css({'text-anchor': 'end'}); } return chart; diff --git a/addons/web/static/src/scss/graph_view.scss b/addons/web/static/src/scss/graph_view.scss index 547e72ffab1..f78df83cc83 100644 --- a/addons/web/static/src/scss/graph_view.scss +++ b/addons/web/static/src/scss/graph_view.scss @@ -24,6 +24,14 @@ // ligther area color fill-opacity: 0.1; } + .nv-lineChart .nv-x.nv-axis .nv-axisMaxMin-x { + &.nv-axisMin-x text { + text-anchor: start !important; + } + &.nv-axisMax-x text { + text-anchor: end !important; + } + } } } }