Angular Google Charts - 負值條形圖



以下是一個負值條形圖示例。

我們在 Google Charts 配置語法 章節中已瞭解用於繪製圖表所使用的配置。接下來讓我們看一個負值條形圖示例。

示例

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],
      ["2013", -1000],
      ["2014", 1170],
      ["2015", 1250],
      ["2016", 1530]
   ];
   columnNames = ['Year', 'Asia'];
   options = { };
   width = 550;
   height = 400;
}

結果

驗證結果。

Negative Bar Chart
angular_googlecharts_bar_charts.htm
廣告