負值柱狀圖



以下帶負值的柱狀圖是一個示例。

我們已經在 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: 'column'
      },
      title: {
         text: 'Column chart with negative values'
      },
      xAxis:{
         categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']        
      },     
      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]
         }
      ]
   };
}

結果

驗證結果。

Column Chart with negative values
angular_highcharts_column_charts.htm
廣告
© . All rights reserved.