]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Clip chart area before filling
authorAkihiko Kusanagi <nagi@nagi-p.com>
Sun, 2 Jul 2017 06:40:00 +0000 (15:40 +0900)
committerEvert Timberg <evert.timberg+github@gmail.com>
Tue, 4 Jul 2017 11:27:14 +0000 (07:27 -0400)
- Add clip and unclip around doFill() call
- This fixes #4450

src/plugins/plugin.filler.js

index 9354e4ed58d8c32b1c681ad4b8c6d00beccead1f..2a91d38e81483c3dfb723c199a9d3a9106c19fe9 100644 (file)
@@ -296,6 +296,7 @@ module.exports = function(Chart) {
                                return;
                        }
 
+                       var ctx = chart.ctx;
                        var el = meta.el;
                        var view = el._view;
                        var points = el._children || [];
@@ -303,7 +304,9 @@ module.exports = function(Chart) {
                        var color = view.backgroundColor || defaults.global.defaultColor;
 
                        if (mapper && color && points.length) {
-                               doFill(chart.ctx, points, mapper, view, color, el._loop);
+                               helpers.canvas.clipArea(ctx, chart.chartArea);
+                               doFill(ctx, points, mapper, view, color, el._loop);
+                               helpers.canvas.unclipArea(ctx);
                        }
                }
        };