Angular Highcharts:缺少值的面积图(Area Chart with missing values)
让我们看一个缺少值的面积图的例子。我们在图表中添加了spacingBottom属性。
charts
将图表的spacingBottom配置为30。它表示图表底部边缘和内容之间的空间(绘图区域、轴标题和标签、标题、副标题或顶部位置的图例)。
var chart = { type: 'area', spacingBottom: 30 };
例子
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', spacingBottom: 30 }, title: { text: 'Fruit consumption *' }, subtitle : { text: '* Jane\'s banana consumption is unknown', floating: true, align: 'right', verticalAlign: 'bottom', y: 15 }, legend : { layout: 'vertical', align: 'left', verticalAlign: 'top', x: 150, y: 100, floating: true, borderWidth: 1, backgroundColor: ( Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF' }, xAxis:{ categories: ['Apples', 'Pears', 'Oranges', 'Bananas', 'Grapes', 'Plums', 'Strawberries', 'Raspberries'] }, yAxis : { title: { text: 'Y-Axis' }, labels: { formatter: function () { return this.value; } } }, tooltip : { formatter: function () { return '<b>' + this.series.name + '</b><br/>' + this.x + ': ' + this.y; } }, plotOptions : { area: { fillOpacity: 0.5 } }, credits:{ enabled: false }, series: [ { name: 'John', data: [0, 1, 4, 4, 5, 2, 3, 7] }, { name: 'Jane', data: [1, 0, 3, null, 3, 1, 2, 1] } ] }; }
结果