Angular Google Charts - 散點圖
以下是一個散點圖的示例。
我們在 Google Charts 配置語法 章節已經瞭解了繪製圖表時使用的配置。現在,讓我們看一個散點圖的示例。
配置
我們使用了 **ScatterChart** 類展示散點圖。
type = 'ScatterChart';
示例
app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'Age vs Weight';
type='ScatterChart';
data = [
[8,12],
[4, 5.5],
[11,14],
[4,5],
[3,3.5],
[6.5,7]
];
columnNames = ['Age', 'Weight'];
options = {
};
width = 550;
height = 400;
}
結果
驗證結果。
廣告