Chartjs-Create custom legend labels

2๐Ÿ‘

โœ…

I think the issue is the syntax you are using to return the object by callback of map method. Being an object, you should put it in brackets.

plugins: {
  legend: {
     labels: {
       generateLabels: (_chart) => {
         return intervals.map((obj, i) => 
           ({
             text: `UCL ${i} ${obj.max}`,
             fillStyle: '#34d399',
             index: i,
           })
         );
       }
    }
  }
},

Leave a comment