[Chartjs]-Hiding legend in PrimeNG

15๐Ÿ‘

โœ…

You need to bind options to an object like this :

<p-chart type="doughnut" [data]="monthlyTeamCost" [options]="chartOptions"></p-chart>

Then in you TS File :

this.chartOptions = {
  legend: {display: false}
}

Prime NG is a binding of Chart.JS (for charting part of the library), so you can found the exhaustive list of options in the Chart.JS web site : http://www.chartjs.org/docs/latest/

0๐Ÿ‘

You can do like this.

HTML:

<p-chart type="horizontalBar" [data]="data" [options]="options"></p-chart>

In your TS file:

options = {
  legend: {display: false}  
}

0๐Ÿ‘

options: {
   plugins: {
     legend: {display: false},
   }
}

This is the solution.

Leave a comment