根据官方文档,angular2-highcharts在Angular 11中是支持的。只需要安装适当的版本即可。例如,使用npm安装angular2-highcharts时,可以使用以下命令:
npm install angular2-highcharts@0.8.3 --save
然后在代码中引入Highcharts模块:
import { Highcharts } from 'angular2-highcharts';
接着,可以使用Highcharts模块创建图表:
import { Component } from '@angular/core';
import { Highcharts } from 'angular2-highcharts';
@Component({
selector: 'my-app',
template: ' ',
providers: [Highcharts]
})
export class AppComponent {
options: any;
constructor() {
this.options = {
title: { text: 'My chart' },
series: [{
name: 'My series',
data: [1, 2, 3]
}]
};
}
}