Angular 谷歌圖表 - 組織結構圖



以下是組織結構圖示例。

組織結構圖有助於呈現節點層次結構,用於描繪組織中的上級/下級關係。例如,家譜就是一種組織結構圖。我們已經看到在 Google Charts 配置語法 一章中用於繪製圖表時的配置。現在,讓我們來看一個組織結構圖的示例。

配置

我們已經使用 OrgChart 類來顯示組織結構圖。

type='OrgChart';

示例

app.component.ts

import { Component } from '@angular/core';
@Component({
   selector: 'app-root',
   templateUrl: './app.component.html',
   styleUrls: ['./app.component.css']
})
export class AppComponent {
   title = '';
   type = 'OrgChart';
   data = [
      [{v:'Mike', f:'Mike<div style="color:red; font-style:italic">President</div>'},
         '', 'The President'],
      [{v:'Jim', f:'Jim<div style="color:red; font-style:italic">Vice President</div>'},
         'Mike', 'VP'],
      ['Alice', 'Mike', ''],
      ['Bob', 'Jim', 'Bob Sponge'],
      ['Carol', 'Bob', '']
   ];
   columnNames = ["Name","Manager","Tooltip"];
   options = {   
      allowHtml: true
   };
   width = 550;
   height = 400;
}

結果

驗證結果。

Organization Chart
廣告
© . All rights reserved.