Skip to content

Commit

Permalink
Fix line clipping at the chart area borders (#5321)
Browse files Browse the repository at this point in the history
  • Loading branch information
serhii-yakymuk authored and simonbrunel committed Apr 3, 2018
1 parent bee8e3c commit 7c3e934
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/controllers/controller.line.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 7c3e934

Please sign in to comment.