]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
fix colour settings of BeforeLabel and BeforeBody (#4783)
authorRittyan <ritmo500@gmail.com>
Mon, 2 Oct 2017 22:33:03 +0000 (07:33 +0900)
committerEvert Timberg <evert.timberg+github@gmail.com>
Mon, 2 Oct 2017 22:33:03 +0000 (00:33 +0200)
* fix colour settings of BeforeLabel and BeforeBody

* delete redundant variable declaration

* collect label colour setting.

src/core/core.tooltip.js

index 048e1a08a699f2271a23a9c8cd4c97f4aa52d9a6..2acd31e051a1384a236cf8612a379e02a5de60df 100644 (file)
@@ -677,6 +677,7 @@ module.exports = function(Chart) {
                        };
 
                        // Before body lines
+                       ctx.fillStyle = mergeOpacity(vm.bodyFontColor, opacity);
                        helpers.each(vm.beforeBody, fillLineOfText);
 
                        var drawColorBoxes = vm.displayColors;
@@ -684,6 +685,8 @@ module.exports = function(Chart) {
 
                        // Draw body lines now
                        helpers.each(body, function(bodyItem, i) {
+                               var textColor = mergeOpacity(vm.labelTextColors[i], opacity);
+                               ctx.fillStyle = textColor;
                                helpers.each(bodyItem.before, fillLineOfText);
 
                                helpers.each(bodyItem.lines, function(line) {
@@ -701,7 +704,6 @@ module.exports = function(Chart) {
                                                // Inner square
                                                ctx.fillStyle = mergeOpacity(vm.labelColors[i].backgroundColor, opacity);
                                                ctx.fillRect(pt.x + 1, pt.y + 1, bodyFontSize - 2, bodyFontSize - 2);
-                                               var textColor = mergeOpacity(vm.labelTextColors[i], opacity);
                                                ctx.fillStyle = textColor;
                                        }