Chartjs-How can I remove two labels from my legend with an alternative to item.datasetIndex !== 1 && item.datasetIndex !== 4; ? (Charts.js)

0👍

Change your return line in the labels filter function to this: return !(item.datasetIndex === 1 || item.datasetIndex === 4) then it will work

EDIT:
To get your original way to work you can just put parentheses around it, will work too: return (item.datasetIndex !== 1 && item.datasetIndex !== 4)

Leave a comment