Chartjs-How to sort stacked bar chart on certain value of bar in charts.js

0👍

The sort function is currently using the sum:

.sort((a,b) => b.sum - a.sum)

So replace that with the data you want sorted:

.sort((a,b) => b.data[i] - a.data[i])

Where i is the row you desire.

Leave a comment