From 87b1806358e2bdc7e04b671d8232db0417b87b15 Mon Sep 17 00:00:00 2001 From: Toshiki Saito Date: Wed, 30 Nov 2016 15:45:08 +0800 Subject: [PATCH 1/2] Implement clipping --- src/controllers/controller.bar.js | 2 ++ src/controllers/controller.line.js | 5 ++++- src/core/core.canvasHelpers.js | 12 ++++++++++++ src/elements/element.point.js | 29 ++++++++++++++++++++++++++++- 4 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/controllers/controller.bar.js b/src/controllers/controller.bar.js index e9a85aabd22..144660d0ad8 100644 --- a/src/controllers/controller.bar.js +++ b/src/controllers/controller.bar.js @@ -241,12 +241,14 @@ module.exports = function(Chart) { var dataset = me.getDataset(); var i, len; + Chart.canvasHelpers.clipArea(me.chart.chart.ctx, me.chart.chartArea); for (i = 0, len = metaData.length; i < len; ++i) { var d = dataset.data[i]; if (d !== null && d !== undefined && !isNaN(d)) { metaData[i].transition(easingDecimal).draw(); } } + Chart.canvasHelpers.unclipArea(me.chart.chart.ctx); }, setHoverStyle: function(rectangle) { diff --git a/src/controllers/controller.line.js b/src/controllers/controller.line.js index 23d4eedc402..8d78fe59bfd 100644 --- a/src/controllers/controller.line.js +++ b/src/controllers/controller.line.js @@ -286,20 +286,23 @@ module.exports = function(Chart) { var points = meta.data || []; var easingDecimal = ease || 1; var i, ilen; + var chartArea = me.chart.chartArea; // Transition Point Locations for (i=0, ilen=points.length; i Date: Thu, 1 Dec 2016 10:01:35 +0800 Subject: [PATCH 2/2] Implement clipping. revision-1 --- src/controllers/controller.line.js | 3 +-- src/elements/element.point.js | 31 +++++++++++++----------------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/controllers/controller.line.js b/src/controllers/controller.line.js index 8d78fe59bfd..806ab4f3f58 100644 --- a/src/controllers/controller.line.js +++ b/src/controllers/controller.line.js @@ -286,7 +286,6 @@ module.exports = function(Chart) { var points = meta.data || []; var easingDecimal = ease || 1; var i, ilen; - var chartArea = me.chart.chartArea; // Transition Point Locations for (i=0, ilen=points.length; i