Angular Highcharts:反转轴向的曲线图(Spline with inverted Axes)
反转轴向的曲线图
现在让我们通过下面的例子来进一步理解反转轴向的曲线图。
配置
将图表类型配置为曲线图。这里,默认值是“line”。配置要反转的轴向。真正的x轴是垂直的,y轴是水平的。如果图表中有一个柱形图,同样也会反转。这里,默认值为false。
var chart = { type: 'spline', inverted: true };
例子
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: 'spline', inverted: true }, title: { text: 'Atmosphere Temperature by Altitude' }, subtitle: { text: 'According to the Standard Atmosphere Model' }, xAxis:{ reversed: false, title: { enabled: true, text: 'Altitude' }, labels: { formatter: function () { return this.value + 'km'; } }, maxPadding: 0.05, showLastLabel: true }, yAxis: { title:{ text: 'Temperature' }, labels: { formatter: function () { return this.value + '\xB0'; } }, lineWidth: 2 }, legand:{ enabled: false }, tooltip: { headerFormat: '<b>{series.name}</b><br/>', pointFormat: '{point.x} km: {point.y}\xB0C' }, plotOptions: { spline: { marker: { enable: false } } }, series : [{ name: 'Temperature', data: [[0, 15], [10, -50], [20, -56.5], [30, -46.5], [40, -22.1], [50, -2.5], [60, -27.7], [70, -55.7], [80, -76.5]] }] }; }
结果