From: Evert Timberg Date: Fri, 13 Nov 2015 13:20:39 +0000 (-0500) Subject: Update tooltip colour draw code X-Git-Tag: 2.0.0-beta1~23^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e3ba9d88e6148da9b1b8208e35d06fd6f73613b;p=thirdparty%2FChart.js.git Update tooltip colour draw code --- diff --git a/src/core/core.tooltip.js b/src/core/core.tooltip.js index 9b87df388..2ce84a91d 100644 --- a/src/core/core.tooltip.js +++ b/src/core/core.tooltip.js @@ -463,13 +463,19 @@ // Draw Legend-like boxes if needed if (this._options.tooltips.mode != 'single') { - ctx.fillStyle = helpers.color(vm.labelColors[i].borderColor).alpha(vm.opacity).rgbString(); + // Fill a white rect so that colours merge nicely if the opacity is < 1 + ctx.fillStyle = helpers.color('#FFFFFF').alpha(vm.opacity).rgbaString(); ctx.fillRect(xBase, yBase, vm.bodyFontSize, vm.bodyFontSize); - ctx.fillStyle = helpers.color(vm.labelColors[i].backgroundColor).alpha(vm.opacity).rgbString(); + // Border + ctx.strokeStyle = helpers.color(vm.labelColors[i].borderColor).alpha(vm.opacity).rgbaString(); + ctx.strokeRect(xBase, yBase, vm.bodyFontSize, vm.bodyFontSize); + + // Inner square + ctx.fillStyle = helpers.color(vm.labelColors[i].backgroundColor).alpha(vm.opacity).rgbaString(); ctx.fillRect(xBase + 1, yBase + 1, vm.bodyFontSize - 2, vm.bodyFontSize - 2); - ctx.fillStyle = helpers.color(vm.bodyColor).alpha(vm.opacity).rgbString(); // Return fill style for text + ctx.fillStyle = helpers.color(vm.bodyColor).alpha(vm.opacity).rgbaString(); // Return fill style for text } // Body Line