Angular-highcharts-area-spline

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

スプラインを使用した面グラフ

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

チャート

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

var chart = {
   type: 'areaspline'
};

*_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: 'areaspline'
      },
      title: {
        text: 'Average fruit consumption during one week'
      },
      subtitle : {
         style: {
            position: 'absolute',
            right: '0px',
            bottom: '10px'
         }
      },
      legend : {
         layout: 'vertical',
         align: 'left',
         verticalAlign: 'top',
         x: -150,
         y: 100,
         floating: true,
         borderWidth: 1,

         backgroundColor: (
            Highcharts.theme && Highcharts.theme.legendBackgroundColor) ||
              '#FFFFFF'
      },
      xAxis:{
         categories: ['Monday','Tuesday','Wednesday','Thursday',
            'Friday','Saturday','Sunday']
      },
      yAxis : {
         title: {
            text: 'Number of units'
         }
      },
      tooltip : {
         shared: true, valueSuffix: ' units'
      },
      plotOptions : {
         area: {
            fillOpacity: 0.5
         }
      },
      credits:{
        enabled: false
      },
      series: [
         {
            name: 'John',
            data: [3, 4, 3, 5, 4, 10, 12]
         },
         {
            name: 'Jane',
            data: [1, 3, 4, 3, 3, 5, 4]
         }
      ]
   };
}

結果

結果を確認します。

スプラインを使用した面グラフ