Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line Chart - line on the edge get cut fix ( #4202) #5321

Merged
merged 4 commits into from Apr 3, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/controllers/controller.line.js
Expand Up @@ -283,11 +283,19 @@ module.exports = function(Chart) {
var points = meta.data || [];
var area = chart.chartArea;
var ilen = points.length;
var dataset = me.getDataset();
var lineElementOptions = chart.options.elements.line;
var halfBorderWidth = helpers.valueOrDefault(dataset.borderWidth, lineElementOptions.borderWidth) / 2;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not recompute the border width in draw, it's already done in update().

I think meta.dataset._model.borderWidth is more accurate:

var halfBorderWidth = (meta.dataset._model.borderWidth || 0) / 2;

var i = 0;

helpers.canvas.clipArea(chart.ctx, area);
helpers.canvas.clipArea(chart.ctx, {
left: area.left,
right: area.right,
top: area.top - halfBorderWidth,
bottom: area.bottom + halfBorderWidth
});

if (lineEnabled(me.getDataset(), chart.options)) {
if (lineEnabled(dataset, chart.options)) {
meta.dataset.draw();
}

Expand Down