
負的堆疊柱狀圖
以下是負的堆疊柱狀圖示例。
我們已在 Google 圖表配置語法 章節中瞭解了用於繪製圖表的配置。現在,讓我們來看一個負的堆疊柱狀圖示例。
配置
我們使用了 isStacked 選項以堆疊形式顯示基於柱狀的圖表。
options = { isStacked:true, }
示例
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 = 'BarChart'; data = [ ["2012", 900, 390], ["2013", -1000, 400], ["2014", 1170, 440], ["2015", 1250, 480], ["2016", 1530, 540] ]; columnNames = ['Year', 'Asia','Europe']; options = { hAxis: { title: 'Year' }, vAxis:{ minValue:0 }, isStacked:true }; width = 550; height = 400; }
結果
驗證結果。

angular_googlecharts_column_charts.htm
廣告