Angular-googlecharts-column-stacked

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

積み上げ縦棒グラフ

以下は積み上げ縦棒グラフの例です。

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

構成

*isStacked* オプションを使用して、列ベースのチャートを積み上げとして表示しました。
options = {
   isStacked:true,
}

*_app.component.ts_*
import { Component } from '@angular/core';
@Component({
   selector: 'app-root',
   templateUrl: './app.componentl',
   styleUrls: ['./app.component.css']
})
export class AppComponent {
   title = 'Population (in millions)';
   type = 'BarChart';
   data = [
      ["2012", 900, 390],
      ["2013", 1000, 400],
      ["2014", 1170, 440],
      ["2015", 1250, 480],
      ["2016", 1530, 540]
   ];
   columnNames = ['Year', 'Asia','Europe'];
   options = {
      hAxis: {
         title: 'Year'
      },
      vAxis:{
         minValue:0
      },
      isStacked:true
   };
   width = 550;
   height = 400;
}

結果

結果を確認します。

積み上げ縦棒グラフ