[Chartjs]-Chart.js tooltip background color setting

10👍

Use backgroundColor property directly under tooltips .

Try this code :

 tooltips: {
                    yAlign: 'bottom',
                    callbacks: {
                        labelColor: function(tooltipItem, chart) {
                            return {
                                backgroundColor: 'rgb(255, 0, 0)'
                            }
                        },
                    },
            backgroundColor: '#227799'
                }

0👍

tooltips: { backgroundColor: ‘…’} is works, but for dynamical change of background with depend of element (when argument is function) I had to do patch in 3 places of unpacked code of bundle, version 2.7.3 (it may be in higher versions also).

Leave a comment