Cant To CHange Chart.js Legend

πŸ‘:0

Add the correct values to the rgba() – is it the fillColor you want to amend? if so then change this line to read fillColor: 'rgba(255, 255, 255, 1)',. RGBA standing for Red, Green, Blue and Alpha (opacity) – ranges from 0 – 255 for r, g and b, 0 – 1 for alpha

πŸ‘:0

The grey (β€œnear #666”) could be due to the rgba values given (grey), but also sounds like the default color used if no colors are given.
The legend color defaults to match the line and fill colors for the chart.

data:{
        datasets:[
            {
             strokeColor: "#fff",         //color of line and outline of legend
             fillColor: "#fff",     //color of fill and fill of legend
             data: []
             }
        ]
    },

If you are using chart.js2, strokeColor and fillColor have been replaced with borderColor and backgroundColor respectively:

data:{
    datasets:[
        {
         borderColor: "#fff",         //color of line and outline of legend
         backgroundColor: "#fff",     //color of fill and fill of legend
         data: []
         }
    ]
},

Leave a comment