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;
}
結果
驗證結果。
angular_googlecharts_pie_charts.htm
廣告