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
This commit is contained in:
Evert Timberg 2020-01-19 09:03:51 -05:00 committed by GitHub
parent b097fe43c9
commit 216ac70261
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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]);
}