[Chartjs]-Datalabels plugin chartjs showing '[object]' instead of value

2๐Ÿ‘

โœ…

I was able to figure this out, instead of displaying the whole value, which in the current case was an object, I had to use formatter with a callback function fetching value of x, in the plugins option.

options: {
            plugins: {
                datalabels: {
                    formatter: ( val ) => {
                        return val.x
                    },
                 }
             }
    }

Leave a comment