Angular-highcharts-area-percentage

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

パーセントエリアチャート

以下は積み上げ面グラフの例です。

link:/angular_highcharts/angular_highcharts_configuration_syntax [Highcharts構成構文]の章でチャートを描画するために使用される構成についてはすでに見ました。 次に、積み上げ面グラフの例を見てみましょう。

plotOptions

plotOptionsは、各シリーズタイプの構成オブジェクトのラッパーオブジェクトです。 構成オブジェクトは、シリーズ配列で指定された各シリーズ項目に対してオーバーライドできます。 これは、各シリーズの値を互いの上に積み重ねることです。

*plotOptions.area.stacking* を「通常」として使用して、チャートの積み重ねを構成します。 可能な値はnullで、スタックを無効にします。「通常」スタックは値で、「パーセント」はグラフをパーセントでスタックします。
var plotOptions = {
   area: {
      stacking: 'percent',
      lineColor: '#666666',
      lineWidth: 1,
      marker: {
         lineWidth: 1,
         lineColor: '#666666'
      }
   }
};

*_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: {
         type: "area"
      },
      title: {
        text: 'Historic and Estimated Worldwide Population Growth by Region'
      },
      subtitle : {
        text: 'Source: Wikipedia.org'
      },
      xAxis:{
        categories: ['1750', '1800', '1850', '1900', '1950', '1999', '2050'],
        tickmarkPlacement: 'on',
        title: {
           enabled: false
        }
      },
      yAxis : {
        title: {
           text: 'Billions'
        },
        labels: {
           formatter: function () {
              return this.value/1000;
           }
        }
      },
      tooltip : {
        shared: true,
        valueSuffix: ' millions'
      },
      plotOptions : {
        area: {
           stacking: 'percent',
           lineColor: '#666666',
           lineWidth: 1,

           marker: {
              lineWidth: 1,
              lineColor: '#666666'
           }
        }
      },
      credits:{
        enabled: false
      },
      series: [
         {
            name: 'Asia',
            data: [502, 635, 809, 947, 1402, 3634, 5268]
         },
         {
            name: 'Africa',
            data: [106, 107, 111, 133, 221, 767, 1766]
         },
         {
            name: 'Europe',
            data: [163, 203, 276, 408, 547, 729, 628]
         },
         {
            name: 'America',
            data: [18, 31, 54, 156, 339, 818, 1201]
         },
         {
            name: 'Oceania',
            data: [2, 2, 2, 6, 13, 30, 46]
         }
      ]
   };
}

結果

結果を確認します。

パーセント面グラフリンク:/cgi-bin/printpage.cgi [__印刷]