带有负值的条形图
以下是具有负值的条形图示例。
我们已经在 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: 'bar'
},
title: {
text: '具有负值的条形图'
},
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]
}
]
};
}
结果
验证结果。
❮ angular_highcharts_bar_charts.html

