From 216ac702613391d3dc0e8d864ada8a938295a866 Mon Sep 17 00:00:00 2001 From: Evert Timberg Date: Sun, 19 Jan 2020 09:03:51 -0500 Subject: [PATCH] Show color box only on the first line of the tooltip body (#6984) * Show color box only on the first line of the tooltip body * Code review feedback --- src/core/core.tooltip.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/core.tooltip.js b/src/core/core.tooltip.js index e00b486e7..5aff16c63 100644 --- a/src/core/core.tooltip.js +++ b/src/core/core.tooltip.js @@ -788,12 +788,12 @@ class Tooltip extends Element { helpers.each(bodyItem.before, fillLineOfText); lines = bodyItem.lines; - for (j = 0, jlen = lines.length; j < jlen; ++j) { - // Draw Legend-like boxes if needed - if (displayColors) { - me._drawColorBox(ctx, pt, i, rtlHelper); - } + // Draw Legend-like boxes if needed + if (displayColors && lines.length) { + me._drawColorBox(ctx, pt, i, rtlHelper); + } + for (j = 0, jlen = lines.length; j < jlen; ++j) { fillLineOfText(lines[j]); } -- 2.47.2