帶有彈出切片的餅圖



下面是帶彈出切片的餅圖示例。

我們已經在Google 圖表配置語法章節中看到了用於繪製圖表的配置。現在,讓我們看一個帶彈出切片的餅圖示例。

配置

我們使用 slices 配置來顯示帶彈出切片的餅圖。

options = {    
   slices: {  
      1: {offset: 0.2},
      3: {offset: 0.3}                   
   },
};

示例

app.component.ts

import { Component } from '@angular/core';
@Component({
   selector: 'app-root',
   templateUrl: './app.component.html',
   styleUrls: ['./app.component.css']
})
export class AppComponent {
   title = 'Browser market shares at a specific website, 2014';
   type = 'PieChart';
   data = [
      ['Firefox', 45.0],
      ['IE', 26.8],
      ['Chrome', 12.8],
      ['Safari', 8.5],
      ['Opera', 6.2],
      ['Others', 0.7] 
   ];
   columnNames = ['Browser', 'Percentage'];
   options = {    
      slices: {  
         1: {offset: 0.2},
         3: {offset: 0.3}                   
      },
   };
   width = 550;
   height = 400;
}

結果

驗證結果。

Pie Chart with exploded slices
angular_googlecharts_pie_charts.htm
廣告
© . All rights reserved.