๐:0
you have overriden the default onClick method for the legend legend: { display: true, position: "bottom", onClick: null }
remove the onClick: null
and try again. It should work then
EDIT: Dear, in your afterDraw you never check if the dataset is hidden you always draw te text. And since the data is still in the data object it will just draw it