안되는데.. 일단 저장 ㅠㅠ
const noData = {
id: 'noData',
afterDatasetsDraw :((chart, args, plugins) => {
const {ctx, data, chartArea : {top, bottom, left, right, width, height} } = chart;
ctx.save();
if(mainMixedChart[propertyNM].data.datasets[0].data.length === 0){
ctx.fillStyle = 'rgba(102,102,102, 0.8)';
ctx.fillRect(left, top, width, height);
ctx.font = 'bold 20px sans-serif';
ctx.fillStyle = 'black';
ctx.textAlign = 'center';
ctx.fillText('No Data Available', left+width/2, top+height/2)
}
}),
};
mainMixedChart[propertyNM].options.plugins = [noData];
https://www.youtube.com/watch?v=J4pKka2tMBA
728x90
300x250