Chartjs-Hiding Chart.js labels in Angular6

2๐Ÿ‘

โœ…

I fixed my issue,

I used this [legend]="doughnutChartLegend"

.html

<canvas baseChart
                        [data]="doughnutChartData" [labels]="doughnutChartLabels"
                        [options]="doughnutChartOptions" [legend]="doughnutChartLegend"
                        [chartType]="doughnutChartType"
                        [colors]="[{backgroundColor: ['rgb(116, 90, 242)', 'rgb(30, 136, 229)', '#06d79c', 'rgb(236, 239, 241)']}]"
                        (chartHover)="chartHovered($event)"
                        (chartClick)="chartClicked($event)"></canvas>

.ts

// Doughnut
  public doughnutChartLabels: string[] = [
    'Total',
    'Vacant Dirty',

  ];
  public doughnutChartOptions: any = {
    borderWidth: 2,
    maintainAspectRatio: true,
   cutoutPercentage: 55,
  };
  responsive: true;
  public doughnutChartData: number[] = [51, 1];
  public doughnutChartType: string = 'doughnut';
  public doughnutChartLegend: boolean = false;

Leave a comment