Chartjs-Duplicate of legends are Produced in ng2 chart

0👍

The legend has a filter parameter which you can use to hide same labels: https://www.chartjs.org/docs/latest/configuration/legend.html#legend-label-configuration

EDIT:
Sample to filter out all duplicates: https://jsfiddle.net/Leelenaleee/vto6z3g4/15/

options: {
    legend: {
        labels: {
        filter: (legendItem,chartData) => {
          return !(chartData.labels.indexOf(legendItem.text) < legendItem.index);
        }
      }
    }
  }

Leave a comment