Angular Google Charts - 堆積面積圖



以下是一個堆積面積圖示例

我們在 Google Charts 配置語法 中已經看到了繪製圖表中使用的配置。現在,讓我們看一個堆積面積圖的示例。

配置

我們已經使用了 isStacked 配置來顯示堆積圖。

options = { 
   isStacked:true, hAxis: {
      title: 'Year'
   }  
};

示例

app.component.ts

import { Component } from '@angular/core';
@Component({
   selector: 'app-root',
   templateUrl: './app.component.html',
   styleUrls: ['./app.component.css']
})
export class AppComponent {
   title = 'Area Chart';
   type = 'AreaChart';
   data = [
      ["2013", 1000, 400],
      ["2014", 1170, 460],
      ["2015", 660, 1120],
      ["2016", 1030, 540]
   ];
   columnNames = ['Year', 'Sales',"Expenses"];
   options = { 
      isStacked:true,
      hAxis: {
         title: 'Year'
      }  
   };
   width = 550;
   height = 400;
}

結果

驗證結果。

Stacked Area Chart
angular_googlecharts_area_charts.htm
廣告
© . All rights reserved.