How to change color of hidden legend item instead of strike-through in Chart.js
<p>I was looking at this code and added ctx.fillStyle = 'red', and got this. I click on eBooks to hide its data but instead of eBooks being red, Microforms and Audiovisuals Mats were changed to red. <a href="https://i.stack.imgur.com/j4Tgb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/j4Tgb.png" alt="enter image description here"></a></p>

<pre><code>var fillText = function(x, y, legendItem, textWidth) 
{
    ctx.fillText(legendItem.text, boxWidth + (fontSize / 2) + x, y);

    if (legendItem.hidden) {
        // Strikethrough the text if hidden
        //ctx.beginPath();
        //ctx.lineWidth = 2;
        //ctx.moveTo(boxWidth + (fontSize / 2) + x, y + (fontSize / 2));                                                
        //ctx.lineTo(boxWidth + (fontSize / 2) + x + textWidth, y + (fontSize / 2));
        //ctx.stroke();
        ctx.fillStyle = 'red'; //added here                                                
    }                                
};
</code></pre>