Angular-highcharts-area-missing

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

欠損値がある面グラフ

以下は、欠損値がある面グラフの例です。

link:/angular_highcharts/angular_highcharts_configuration_syntax [Highcharts構成構文]の章でチャートを描画するために使用される構成についてはすでに見ました。 ここで、欠損値がある面グラフの例を見てみましょう。 チャートにspacingBottom属性を追加しました。

チャート

チャートの spacingBottom を30として構成します。 これは、グラフの下端とコンテンツ(プロット領域、軸のタイトルとラベル、タイトル、サブタイトル、または上部の凡例)の間のスペースを示します。

var chart = {
   type: 'area',
   spacingBottom: 30
};

*_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',
         spacingBottom: 30
      },
      title: {
         text: 'Fruit consumption* '
      },
      subtitle : {
         text: '* Jane\'s banana consumption is unknown',
         floating: true,
         align: 'right',
         verticalAlign: 'bottom',
         y: 15
      },
      legend : {
         layout: 'vertical',
         align: 'left',
         verticalAlign: 'top',
         x: 150,
         y: 100,
         floating: true,
         borderWidth: 1,
         backgroundColor: (
            Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
      },
      xAxis:{
         categories: ['Apples', 'Pears', 'Oranges', 'Bananas', 'Grapes', 'Plums', 'Strawberries', 'Raspberries']
      },
      yAxis : {
         title: {
            text: 'Y-Axis'
         },
         labels: {
            formatter: function () {
               return this.value;
            }
         }
      },
      tooltip : {
         formatter: function () {
            return '<b>' + this.series.name + '</b><br/>' +
               this.x + ': ' + this.y;
         }
      },
      plotOptions : {
         area: {
            fillOpacity: 0.5
         }
      },
      credits:{
         enabled: false
      },
      series: [
         {
            name: 'John',
            data: [0, 1, 4, 4, 5, 2, 3, 7]
         },
         {
            name: 'Jane',
            data: [1, 0, 3, null, 3, 1, 2, 1]
         }
      ]
   };
}

結果

結果を確認します。

欠損値のあるエリアグラフ