Chart.JS Display 5 largest values in the legend

I was wondering how to go about using Chart.JS to limit the amount of items displayed in the legend. I’d like to set essentially a max amount of 5, and it’ll display the 5 largest values in the legend. I’m assuming this would be done with a filter function in the options.plugins.labels, but I’m not sure how to go about checking the datasets against each other and then only displaying the 5 largest.

Thanks so much for the help