живая демоверсия Мне нужно добавить службу и наблюдаемый улов для этих диаграмм, потому что диаграмма - это живые данные, и я обнаружил проблему, когда браузер блокирует, API-интерфейс time-rows.json продолжает работать вконсольный журнал (сеть).
![](https://i.stack.imgur.com/839EW.png)
import { Component, OnInit, OnDestroy } from "@angular/core";
import * as Highcharts from "highcharts";
import * as HighchartsMore from "highcharts/highcharts-more";
import * as HighchartsExporting from "highcharts/modules/exporting";
declare var require: any;
require("highcharts/modules/data")(Highcharts);
HighchartsMore(Highcharts);
HighchartsExporting(Highcharts);
@Component({
selector: "app-chart",
templateUrl: "./chart.component.html"
})
export class ChartComponent implements OnInit, OnDestroy {
constructor() {}
ngOnInit() {
Highcharts.chart("container", {
chart: {
type: "spline"
},
title: {
text: "Live Data (Rows JSON)"
},
subtitle: {
text: "Data input from a remote JSON file"
},
data: {
rowsURL: "https://demo-live-data.highcharts.com/time-rows.json",
firstRowAsNames: false,
enablePolling: true
}
});
}
ngOnDestroy() {}
}
<div
id="container"
style="min-width: 310px; height: 400px; margin: 0 auto"
></div>