I want to hide the label in a tooltip because it shows undefined

☆樱花仙子☆ 提交于 2019-12-06 09:05:06

Just set the tooltipTitleFontSize to 0 in your options.


Preview


Script

myLine = new Chart(ctx).Line(lineChartData, {
    ...
    tooltipTitleFontSize: 0
});

The accepted answer won't work in newer versions of chart.js, as Aman said in comments, what you can use now is this:

tooltips: { titleFontSize: 0 }

Example:

var bar_chart = document.getElementById('bar_canvas').getContext('2d');
window.myBar = new Chart(bar_chart, {
    type: 'bar',
    data: bar_chart_data,
    options: {
        tooltips: {
            titleFontSize: 0,
            bodyFontSize: 14,
        }
    }
});

I know I am late, but I guess it still has merit to add this one.

check this : https://stackoverflow.com/a/44632748/12061669

It uses a function to hide the title:

options:{
   tooltips:{
     callbacks:{
        title: ()=>{}
     }
   }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!