饼图标签未定义离子 3

pie chart label undefined ionic 3

我使用api填充饼图数据我成功填充数据但标签数据未​​定义

这是我的 ts 文件

let  arrayLabel =[];
     let arrayData = [];

      for (let index = 0; index < this.responseData.length; index++) {
        // this.asset_category =  this.responseData[index].asset_category;
        // this.asset_value =  this.responseData[index].asset_value;
        // this.asofdate =  this.responseData[index].asofdate;

        arrayLabel.push(this.responseData[index].asset_category);
        arrayData.push( this.responseData[index].asset_value);
      }

      console.log(arrayLabel);
      console.log(arrayData);

      this.pieChartLabels =  [arrayLabel] ;
      this.pieChartData =  [arrayData];

这是我的 html 文件

<div style="display: block" *ngIf='pieChartData'>
    <canvas baseChart  #baseChart
            [data]="pieChartData"
            [labels]="pieChartLabels"
            [chartType]="pieChartType"
            (chartHover)="chartHovered($event)"
            (chartClick)="chartClicked($event)"></canvas>
  </div>

我还附上了当我点击粉红色而不是显示所有标签时的屏幕截图name.when我点击标签的其他部分显示未定义

试试这个:

this.pieChartLabels =  arrayLabel;

...而不是:

this.pieChartLabels =  [arrayLabel] ;