面向 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
广告