Angular Google 圖表 - 基本階梯圖



下面是階梯圖的示例。

我們已經瞭解了在 Google 圖表配置語法 章節中繪製圖表時所使用的配置。現在,讓我們看一個階梯圖的示例。

配置

我們已經使用 SteppedAreaChart 類來展示一個階梯圖。

type = 'SteppedAreaChart';

示例

app.component.ts

import { Component } from '@angular/core';
@Component({
   selector: 'app-root',
   templateUrl: './app.component.html',
   styleUrls: ['./app.component.css']
})
export class AppComponent {
   title = "'The decline of 'The 39 Steps'";
   type = 'SteppedAreaChart';
   data = [
      ["Alfred Hitchcock (1935)", 8.4, 7.9],
      ["Ralph Thomas (1959)",     6.9,         6.5],
      ["Don Sharp (1978)",        6.5,         6.4],
      ["James Hawes (2008)",      4.4,         6.2]
   ];
   columnNames = ['Director (Year)', 'Rotten Tomatoes','IMDB'];
   options = { 
      vAxis:{
         title:'Accumulated Rating'
      }  
   };
   width = 550;
   height = 400;
}

結果

驗證結果。

Stepped Chart
angular_googlecharts_stepped_charts.htm
廣告