From e2e0135a753feca96e2de0010b693fc5026cdaf3 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Thu, 14 Feb 2019 13:27:01 +0000 Subject: [PATCH] [FIX] web: first and last line chart x label shown The graph view displaying a line chart has had some recent changes in b23a9813202. Now it is of the full width of container but when there is less than 4 labels (thanks to c4937132a38) the first and last labels may be cut because they are by default aligned on the middle with its tick (so for the first label, the half left may be missing, and the last the half right may be missing). With this change, we align labels as expected. This could be done in CSS sheet (with `.nv-axisMin-x > text { text-transform: start!important; }`) but here it is done only in the given instance. opw-1917560 closes #31116 --- addons/web/static/src/js/views/graph/graph_renderer.js | 4 ++++ 1 file changed, 4 insertions(+) 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..358426c86b9 100644 --- a/addons/web/static/src/js/views/graph/graph_renderer.js +++ b/addons/web/static/src/js/views/graph/graph_renderer.js @@ -451,6 +451,10 @@ 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;