带负值的面积图



我们在 Highcharts 配置语法 章节中已经看到了用于绘制此图形的配置。现在我们考虑以下示例,以进一步了解基本面积图。

示例

app.component.ts

import { Component } from '@angular/core';
import * as Highcharts from 'highcharts';
@Component({
   selector: 'app-root',
   templateUrl: './app.component.html',
   styleUrls: ['./app.component.css']
})
export class AppComponent {
   highcharts = Highcharts;
   chartOptions = {   
      chart: {
         type: "area"
      },
      title: {
         text: 'Area chart with negative values'
      },
      xAxis:{
        categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
      },
      credits:{
        enabled: false
      },
      series: [
         {
            name: 'John',
            data: [5, 3, 4, 7, 2]
         }, 
         {
            name: 'Jane',
            data: [2, -2, -3, 2, 1]
         }, 
         {
            name: 'Joe',
            data: [3, 4, 4, -2, 5]
         }
      ]
   };
}

结果

验证结果。

Area Chart with negative values
angular_highcharts_area_charts.htm
广告