Chart.js icon indicating copy to clipboard operation
Chart.js copied to clipboard

Still blacked text and background color on tooltips.

Open mbsaberi opened this issue 9 years ago • 9 comments

[BUG] Hi. On my project, tooltip text and background color are both blacked. Texts are not readable, and any of my changes could not solve the problem. I've checked different solutions mentioned in #4766, #4741, #4783, and ... But none of them could not solve my problem. I am using the latest version of Chart.js. Also I've test it in both Chrome and Firefox.

untitled-3

mbsaberi avatar Nov 30 '17 11:11 mbsaberi

@mbsmt could you provide a jsfiddle that demonstrates the example?

jcopperfield avatar Nov 30 '17 13:11 jcopperfield

@jcopperfield it's really strange. It worked well without any issue out of my project. https://jsfiddle.net/a6uqexmw/2/

What might be happened that caused the problem? Compare the jsfiddle above with this new snapshot ... untitled-1

mbsaberi avatar Nov 30 '17 14:11 mbsaberi

@mbsmt I think you might have a local problem with your browsers. issue-5012-black-tooltip-text

jcopperfield avatar Nov 30 '17 15:11 jcopperfield

@jcopperfield I tested it with Chrom, Firefox, IE. All of them have that problem!

mbsaberi avatar Nov 30 '17 15:11 mbsaberi

What version of Chart.js are you using, I think it's a bug fixed in 2.7.1 (#4783)

simonbrunel avatar Nov 30 '17 15:11 simonbrunel

@mbsmt Might be a driver problem. Your fiddle doesn't recreate the bug for me.

jcopperfield avatar Nov 30 '17 15:11 jcopperfield

@simonbrunel It's 2.7.1, the latest version. I tested it outside my project in a standalone html file, and it worked without any problem. I had to remove all included CSS and JS files one by one from my project and finally I found a conflict between Chart.js and Persianumber.js.

mbsaberi avatar Nov 30 '17 19:11 mbsaberi

@mbsmt it seems like Persianumber.js overwrites the parseInt and parseFloat functions. This is not good practice. However if you the problem is that the parseInt implementation doesn't include the radix argument, which causes the problem. You can either remove the parseInt and parseFloat functions from the Persianumber.js or you should add the radix argument to parseInt, like shown below.

origParseInt = parseInt;
parseInt = function(str, radix) {
    str = str && str.toString().replace(/[\u06F0\u06F1\u06F2\u06F3\u06F4\u06F5\u06F6\u06F7\u06F8\u06F9]/g, function(v){return String.fromCharCode(v.charCodeAt(0) - 1728)}).replace(/[\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669]/g, function(v){return String.fromCharCode(v.charCodeAt(0) - 1584)}).replace(/[\u066B]/g, '.');
    return origParseInt(str, radix);
};

jcopperfield avatar Dec 01 '17 08:12 jcopperfield

@jcopperfield That's it... You solved my problem. Thank you and all other guys.

mbsaberi avatar Dec 01 '17 09:12 mbsaberi