面向 Angular 的 Google Charts - 基本柱狀圖
下面是一個基本柱狀圖示例。
我們已經在 面向 Google Charts 的配置語法 章節中瞭解了繪製圖表時用到的配置。現在,我們來看一個基本柱狀圖示例。
配置
我們使用 **ColumnChart** 類來顯示基於列的圖表。
type='ColumnChart';
示例
app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'Population (in millions)';
type = 'ColumnChart';
data = [
["2012", 900],
["2013", 1000],
["2014", 1170],
["2015", 1250],
["2016", 1530]
];
columnNames = ['Year', 'Asia'];
options = {};
width = 550;
height = 400;
}
結果
驗證結果。
angular_googlecharts_column_charts.htm
廣告