Angular-highcharts-pie-basic

提供:Dev Guides
移動先:案内検索

角度ハイチャート-基本的な円グラフ

以下は円グラフの例です。

link:/angular_highcharts/angular_highcharts_configuration_syntax [Highcharts構成構文]の章でチャートを描画するために使用される構成についてはすでに見ました。 次に、基本的な円グラフの例を見てみましょう。 また、追加の構成も理解します。 チャートのtype属性を変更しました。

チャート

グラフタイプを「パイ」ベースに設定します。 chart.type は、チャートのシリーズタイプを決定します。 ここで、デフォルト値は「line」です。

var series = {
   type: 'pie'
};

*_app.component.ts_*
import { Component } from '@angular/core';
import * as Highcharts from 'highcharts';
@Component({
  selector: 'app-root',
  templateUrl: './app.componentl',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
   highcharts = Highcharts;
   chartOptions = {
      chart : {
         plotBorderWidth: null,
         plotShadow: false
      },
      title : {
         text: 'Browser market shares at a specific website, 2014'
      },
      tooltip : {
         pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
      },
      plotOptions : {
         pie: {
            allowPointSelect: true,
            cursor: 'pointer',
            dataLabels: {
               enabled: true,
               format: '<b>{point.name}%</b>: {point.percentage:.1f} %',
               style: {
                  color: (Highcharts.theme && Highcharts.theme.contrastTextColor)||
                  'black'
               }
            }
         }
      },
      series : [{
         type: 'pie',
         name: 'Browser share',
         data: [
            ['Firefox',   45.0],
            ['IE',       26.8],
            {
               name: 'Chrome',
               y: 12.8,
               sliced: true,
               selected: true
            },
            ['Safari',    8.5],
            ['Opera',     6.2],
            ['Others',      0.7]
         ]
      }]
   };
}

結果

結果を確認します。

基本的な円グラフ