Chart.js: Doughnut tooltips displayColors problem

Created on 11 Sep 2017  ·  11Comments  ·  Source: chartjs/Chart.js

After the upgrade to 2.7 I found a bug.
When the option displayColors: false is set the text color of tooltips are black.
I tryed to set the bodyFontColor: '#ffffff', etc but the color text on the tooltips are always black.

this is my code:

var myChart  = new Chart(ctx, {
    type: 'doughnut',
    data: data<?php echo $grafico_key; ?>,
    options: {
        responsive: true,
        maintainAspectRatio: false,
        animation: {
            duration: 2000,
        },
        legend: {
            display: false
        },
        tooltips: {
            mode: 'label',
            position: 'nearest',
            xPadding: 10,
            yPadding: 10,
            bodyFontSize: 15,
            bodySpacing: 8,
            caretSize: 10, //freccetta
            displayColors: false,
            bodyFontColor: '#fff',
            callbacks: {
                label: function(tooltipItem, data) {
                    var valore = aggiungiPercento(data.datasets[0].data[tooltipItem.index].toString().trim());
                    return (data.labels[tooltipItem.index] + ": " + valore);
                },
                labelTextColor: function(tooltipItem, chart) {
                    return '#ffffff';
                }
            }
        }
    }
}); 

Edit (SB): code formatting

bug

Most helpful comment

@EmilMoe #4766 has a fix for this

All 11 comments

+1. Same problem here. :/

@officinainformatica @infodark can one of you build a jsfiddle that reproduce this issue?

Is the first time with jsfiddle but I try
https://jsfiddle.net/48so5r63/

Can reproduce this issue (fiddle), introduced by #4199.

This is a breaking change. We need to enable displayColors to make "tooltip" visible. I think this should be on documentation or update notes for 2.7.

I hope you can fix this on 2.7.1.

I'm happy to review a PR for fixing this if someone has it.

What is the roadmap to this fix? (Days, weeks, months) I'm still building for development, but in a couple of months it needs to go into production.

@EmilMoe #4766 has a fix for this

Thanks @etimberg I will stay standby for now then

Done in #4783

Was this page helpful?
0 / 5 - 0 ratings