Angular-googlecharts-pie-basic

提供:Dev Guides
移動先:案内検索

Google Angular Charts-基本的な円グラフ

以下は、基本的な円グラフの例です。

link:/angular_googlecharts/angular_googlecharts_configuration_syntax [Googleグラフの構成構文]の章で、グラフを描画するために使用される構成を既に確認しました。 次に、円グラフの例を見てみましょう。

構成

*PieChart* クラスを使用して、円グラフを表示しました。
type = 'PieChart';

*_app.component.ts_*
import { Component } from '@angular/core';
@Component({
   selector: 'app-root',
   templateUrl: './app.componentl',
   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;
}

結果

結果を確認します。

円グラフ