[Chartjs]-Chart js. How to align text by the center of the tooltip?

6👍

You are using 2.5.0, which has bug. Update to latest 2.8.0, its working fine already. https://jsfiddle.net/zhuhang95/utc9wenx/4/

Usually, using titleAlign and bodyAlign should do the trick.

Chart.js docs: https://www.chartjs.org/docs/latest/configuration/tooltip.html#alignment

        options: {
            tooltips: {
                titleAlign: 'center',
                bodyAlign: 'center'
            }
        }

0👍

Your align properties were messing things up.
Give this a try:

https://jsfiddle.net/m7s43hrs/2951/

Leave a comment