This demo uses imperative chart updates. The generated code is a faithful Angular translation: open it in CodeSandbox to run and tweak.
import { Component, AfterViewInit, OnDestroy, ViewChild } from '@angular/core';
import {
ChartComponent,
ApexAxisChartSeries,
ApexNonAxisChartSeries,
ApexChart,
ApexXAxis,
ApexYAxis,
ApexTitleSubtitle,
ApexDataLabels,
ApexStroke,
ApexFill,
ApexLegend,
ApexTooltip,
ApexMarkers,
ApexPlotOptions,
ApexResponsive,
ApexGrid,
ApexAnnotations,
ApexStates,
ApexTheme,
NgApexchartsModule,
} from 'ng-apexcharts';
export type ChartOptions = {
series?: ApexAxisChartSeries | ApexNonAxisChartSeries;
chart?: ApexChart;
xaxis?: ApexXAxis;
yaxis?: ApexYAxis | ApexYAxis[];
title?: ApexTitleSubtitle;
subtitle?: ApexTitleSubtitle;
dataLabels?: ApexDataLabels;
stroke?: ApexStroke;
fill?: ApexFill;
legend?: ApexLegend;
tooltip?: ApexTooltip;
markers?: ApexMarkers;
plotOptions?: ApexPlotOptions;
responsive?: ApexResponsive[];
grid?: ApexGrid;
annotations?: ApexAnnotations;
states?: ApexStates;
theme?: ApexTheme;
colors?: string[];
labels?: any;
};
@Component({
selector: 'app-chart',
standalone: true,
imports: [NgApexchartsModule],
templateUrl: './chart.component.html',
})
export class AppChart implements AfterViewInit, OnDestroy {
@ViewChild('chart') chart!: ChartComponent;
public chartOptions: Partial<ChartOptions> = {
series: [
{
name: 'us-east-1',
data: [
142,
138,
155,
149,
151,
144,
139,
null,
null,
null,
158,
162,
147,
150,
141,
146,
],
},
{
name: 'eu-west-1',
data: [
210,
225,
null,
218,
null,
208,
215,
228,
null,
null,
219,
null,
224,
null,
null,
null,
],
},
{
name: 'ap-south-1',
data: [
null,
null,
null,
null,
296,
301,
288,
295,
302,
310,
318,
324,
305,
null,
null,
null,
],
},
],
chart: {
height: 350,
type: 'line',
zoom: {
enabled: false,
},
animations: {
enabled: false,
},
},
stroke: {
width: [5, 5, 4],
curve: 'smooth',
},
labels: [
'2025-06-04T00:00:00',
'2025-06-04T01:00:00',
'2025-06-04T02:00:00',
'2025-06-04T03:00:00',
'2025-06-04T04:00:00',
'2025-06-04T05:00:00',
'2025-06-04T06:00:00',
'2025-06-04T07:00:00',
'2025-06-04T08:00:00',
'2025-06-04T09:00:00',
'2025-06-04T10:00:00',
'2025-06-04T11:00:00',
'2025-06-04T12:00:00',
'2025-06-04T13:00:00',
'2025-06-04T14:00:00',
'2025-06-04T15:00:00',
],
title: {
text: 'API Response Time by Region',
},
subtitle: {
text: 'Monitoring dropouts (null values) render as gaps',
},
xaxis: {
type: 'datetime',
labels: {
format: 'HH:mm',
},
},
yaxis: {
labels: {
formatter: (val) => {
return val + ' ms'
},
},
},
};
ngAfterViewInit() {
(window as any).ApexCharts.setLicense('APEX-eyJpc3N1ZURhdGUiOiIyMDI2LTA0LTE2IiwiZXhwaXJ5RGF0ZSI6IjIwNTItMDQtMTciLCJwbGFuIjoiZW50ZXJwcmlzZSIsImRvbWFpbnMiOlsiYXBleGNoYXJ0cy5jb20iLCIxMjcuMC4wLjEiXX0=');
}
ngOnDestroy() {
// no cleanup needed
}
}