0

我目前正在开发一个使用 angular 2 并在项目中使用 ng2-charts 的应用程序。该项目由cordova包裹后在浏览器中运行良好。但是,一旦使用 cordova 在 iOS 上运行,所有 ng2-charts 都不会显示。

我想知道是因为 ng2-chart 和 iOS 不兼容还是其他原因?

非常感谢。:)

例如,饼图组件在 iOS 上不起作用,但在浏览器中显示良好。这是我的 pie-chart.component.ts 代码:

import { Component } from '@angular/core';

@Component({
  selector: 'pie-chart',
  templateUrl: './pie-chart.html'
})
export class PieChartComponent {
  // Pie
  public pieChartLabels:string[] = ['A', 'B', 'C'];
  public pieChartData:number[] = [300, 200, 100];
  public pieChartOptions:any = {
    responsive: true
  };
  public pieChartType:string = 'pie';

  // events
  public chartClicked(e:any):void {
    console.log(e);
  }

  public chartHovered(e:any):void {
    console.log(e);
  }
}

pie-chart.html 的代码:

<div style="display: block">
    <canvas baseChart height = "150"
        [data]="pieChartData"
        [labels]="pieChartLabels"
        [options]="pieChartOptions"
        [chartType]="pieChartType"
        (chartHover)="chartHovered($event)"
        (chartClick)="chartClicked($event)">         
    </canvas>
</div>
4

0 回答 0