From 7c3e934062c2679d6e06905b342f6432dd7d87f6 Mon Sep 17 00:00:00 2001 From: serhii-yakymuk Date: Tue, 3 Apr 2018 10:23:16 +0300 Subject: [PATCH] Fix line clipping at the chart area borders (#5321) --- src/controllers/controller.line.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/controllers/controller.line.js b/src/controllers/controller.line.js index 9d9206d5cb2..7aacf2d23e2 100644 --- a/src/controllers/controller.line.js +++ b/src/controllers/controller.line.js @@ -283,15 +283,23 @@ module.exports = function(Chart) { var points = meta.data || []; var area = chart.chartArea; var ilen = points.length; + var halfBorderWidth; var i = 0; - helpers.canvas.clipArea(chart.ctx, area); - if (lineEnabled(me.getDataset(), chart.options)) { + halfBorderWidth = (meta.dataset._model.borderWidth || 0) / 2; + + helpers.canvas.clipArea(chart.ctx, { + left: area.left, + right: area.right, + top: area.top - halfBorderWidth, + bottom: area.bottom + halfBorderWidth + }); + meta.dataset.draw(); - } - helpers.canvas.unclipArea(chart.ctx); + helpers.canvas.unclipArea(chart.ctx); + } // Draw the points for (; i < ilen; ++i) {