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: 'Resolved',
data: [
{ x: '2021', y: 486 },
{ x: '2022', y: 702 },
{ x: '2023', y: 1012, drilldown: 'y2023' },
{ x: '2024', y: 1421, drilldown: 'y2024' },
{ x: '2025', y: 1866, drilldown: 'y2025' },
],
},
],
chart: {
height: 380,
type: 'line',
toolbar: {
show: false,
},
},
drilldown: {
enabled: true,
breadcrumb: {
show: true,
rootLabel: 'All years',
},
series: [
{
id: 'y2023',
name: '2023 by quarter',
data: [
{ x: 'Q1', y: 214, drilldown: 'y2023-q1' },
{ x: 'Q2', y: 238 },
{ x: 'Q3', y: 259 },
{ x: 'Q4', y: 301 },
],
},
{
id: 'y2023-q1',
name: 'Q1 2023 by month',
data: [
{ x: 'Jan', y: 66 },
{ x: 'Feb', y: 70 },
{ x: 'Mar', y: 78 },
],
},
{
id: 'y2024',
name: '2024 by quarter',
data: [
{ x: 'Q1', y: 322 },
{ x: 'Q2', y: 356 },
{ x: 'Q3', y: 341 },
{ x: 'Q4', y: 402 },
],
},
{
id: 'y2025',
name: '2025 by quarter',
data: [
{ x: 'Q1', y: 428 },
{ x: 'Q2', y: 455 },
{ x: 'Q3', y: 471 },
{ x: 'Q4', y: 512 },
],
},
],
},
colors: ['#008FFB'],
stroke: {
width: 3,
curve: 'smooth',
},
title: {
text: 'Support tickets resolved',
align: 'left',
},
subtitle: {
text: 'Dotted points open a level: 2023, 2024 and 2025 break down by quarter.',
align: 'left',
},
grid: {
borderColor: '#e7e7e7',
},
yaxis: {
title: {
text: 'Tickets (thousands)',
},
},
};
ngAfterViewInit() {
(window as any).ApexCharts.setLicense('APEX-eyJleHBpcnlEYXRlIjoiMjEyNi0wNy0wNCIsImlzc3VlRGF0ZSI6IjIwMjYtMDctMjgiLCJwbGFuIjoicHJlbWl1bSIsImRvbWFpbnMiOlsiYXBleGNoYXJ0cy5jb20iLCIxMjcuMC4wLjEiLCJsb2NhbGhvc3QiXSwic2lnIjoieVBmb1VCc0Z3TU9ZdUEyaEZkR0I2Y1FtZ0JITUtXcVdJSjB2NVRESXRZbFR3eDJMUmh6R2x0RUc3VXJ4X0s3b25ZMWRZb2Z2VGItN01ydFYyNDVyOWcifQ==');
}
ngOnDestroy() {
// no cleanup needed
}
}