Chartjs-In Chart.js, how do I hide certain axis labels from a stacked bar chart?

0👍

My coworker figured it out. You just need to add this to the options array:

plugins: {
   datalabels: {
      display: function(context) {
         return context.dataset.data[context.dataIndex] > 0; // only return if greater than zero
      }
   }
}

Here’s how it ends up looking:

enter image description here

Leave a comment