我包括了highcharts模块,并且我想以角度实现highchart的网络图。您能帮我实施它吗?
请在下面找到stackblitz链接:
https://stackblitz.com/edit/angular-sfytxa?file=src%2Fapp%2Fapp.component.ts
答案 0 :(得分:3)
仅需加载 networkgraph模块并像这样初始化它:
import * as Highcharts from "highcharts";
import * as HighchartsNetworkgraph from "highcharts/modules/networkgraph";
HighchartsNetworkgraph(Highcharts);
演示:
我建议您使用highcharts-angular
官方包装。可以在这里下载:https://github.com/highcharts/highcharts-angular
答案 1 :(得分:3)
感谢@Wojciech Chmiel的解决方案,它对我有很大帮助。
但是,对于最新版本的高位图表,角度和其他依赖性,上述解决方案不起作用。它给了我下面的错误
"@angular/animations": "^9.0.6",
"@angular/cdk": "^9.1.3",
"@angular/common": "^9.0.6",
"@angular/compiler": "^9.0.6",
"@angular/core": "^9.0.6",
"@angular/forms": "^9.0.6",
"@angular/http": "^7.2.16",
"@angular/platform-browser": "^9.0.6",
"@angular/platform-browser-dynamic": "^9.0.6",
"@angular/router": "^9.0.6",
angular-highcharts": "^9.0.2",
highcharts": "^8.0.4",
highcharts-angular": "^2.4.0",
我的依赖关系和版本如下
import * as Highcharts from "highcharts";
import HighchartsNetworkgraph from "highcharts/modules/networkgraph";
import HighchartsExporting from "highcharts/modules/exporting";
HighchartsNetworkgraph(Highcharts);
HighchartsExporting(Highcharts);
我的解决方案是
ceiling