Angular Google Charts - 基本饼形图



下面是一个基本饼形图示例。

我们在 Google Charts 配置语法 章节中已经看到了用于绘制图表的配置。现在,让我们看一个饼形图示例。

配置

我们使用 PieChart 类来显示饼形图。

type = 'PieChart';

示例

app.component.ts

import { Component } from '@angular/core';
@Component({
   selector: 'app-root',
   templateUrl: './app.component.html',
   styleUrls: ['./app.component.css']
})
export class AppComponent {
   title = 'Browser market shares at a specific website, 2014';
   type = 'PieChart';
   data = [
      ['Firefox', 45.0],
      ['IE', 26.8],
      ['Chrome', 12.8],
      ['Safari', 8.5],
      ['Opera', 6.2],
      ['Others', 0.7] 
   ];
   columnNames = ['Browser', 'Percentage'];
   options = {          
   };
   width = 550;
   height = 400;
}

结果

验证结果。

Pie Chart
angular_googlecharts_pie_charts.htm
广告
© . All rights reserved.