Angular Google 圖表 - 圓環圖



以下是一個圓環圖的示例。

我們已經看過在 Google 圖表配置語法 章節中用來繪製圖表的配置。現在,我們來看一個圓環圖的示例。

配置

我們使用了 pieHole 配置將餅圖顯示為圓環圖。

options = {    
   pieHole:0.4
};

示例

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 = {    
      pieHole:0.4
   };
   width = 550;
   height = 400;
}

結果

驗證結果。

Donut Chart
angular_googlecharts_pie_charts.htm
廣告