Spline Area Chart in Angular Charts

28 Aug 202624 minutes to read

Spline Area

A spline area chart fills the area beneath a smooth spline curve.

Spline Area chart showing data trends over time

To render a spline area series in your chart, you need to follow a few steps to configure it correctly.

Here’s a concise guide on how to do this:

  1. Set the series type: Define the series type as SplineArea in your chart configuration. This indicates that the data should be represented as a spline area chart, where data points are connected by smooth, curved lines (splines) instead of straight lines.

  2. Register the SplineAreaSeriesService provider: Register SplineAreaSeriesService (along with any other chart services you need) in the component’s providers array.

import { ChartModule } from '@syncfusion/ej2-angular-charts'
import { CategoryService, SplineAreaSeriesService } from '@syncfusion/ej2-angular-charts'


import { Component, OnInit } from '@angular/core';
import { chartData } from './datasource';

@Component({
imports: [
         ChartModule
    ],

providers: [CategoryService, SplineAreaSeriesService],
standalone: true,
    selector: 'app-container',
    template: `<ejs-chart id="chart-container" [primaryXAxis]='primaryXAxis' [title]='title'>
        <e-series-collection>
            <e-series [dataSource]='chartData' type='SplineArea' xName='x' yName='y' name='London' width=2 [marker]='marker'></e-series>
        </e-series-collection>
    </ejs-chart>`
})
export class AppComponent implements OnInit {
    public primaryXAxis?: Object;
    public chartData?: Object[];
    public title?: string;
    public marker?: Object;
    ngOnInit(): void {
        this.chartData = chartData;
        this.primaryXAxis = {
           title: 'Month',
           valueType: 'Category'
        };
        this.marker = { visible: true, width: 10, height: 10 };
        this.title = 'Climate Graph-2012';
    }

}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
export let chartData: Object[] = [
    { x: 'Jan', y: -1 },
    { x: 'Feb', y: -1 },
    { x: 'Mar', y: 2 },
    { x: 'Apr', y: 8 },
    { x: 'May', y: 13 },
    { x: 'Jun', y: 18 },
    { x: 'Jul', y: 21 },
    { x: 'Aug', y: 20 },
    { x: 'Sep', y: 16 },
    { x: 'Oct', y: 10 },
    { x: 'Nov', y: 4 },
    { x: 'Dec', y: 0 }
];

Binding data with series

Bind data via the dataSource property on the series. Map the fields from your records to xName and yName so the chart knows which value drives each point. The included basic sample already demonstrates this binding, with x and y fields surfaced through the chart data.

import { ChartModule } from '@syncfusion/ej2-angular-charts'
import { CategoryService, SplineAreaSeriesService } from '@syncfusion/ej2-angular-charts'


import { Component, OnInit } from '@angular/core';
import { chartData } from './datasource';

@Component({
imports: [
         ChartModule
    ],

providers: [CategoryService, SplineAreaSeriesService],
standalone: true,
    selector: 'app-container',
    template: `<ejs-chart id="chart-container" [primaryXAxis]='primaryXAxis' [title]='title'>
        <e-series-collection>
            <e-series [dataSource]='chartData' type='SplineArea' xName='x' yName='y' name='London' width=2 [marker]='marker'></e-series>
        </e-series-collection>
    </ejs-chart>`
})
export class AppComponent implements OnInit {
    public primaryXAxis?: Object;
    public chartData?: Object[];
    public title?: string;
    public marker?: Object;
    ngOnInit(): void {
        this.chartData = chartData;
        this.primaryXAxis = {
           title: 'Month',
           valueType: 'Category'
        };
        this.marker = { visible: true, width: 10, height: 10 };
        this.title = 'Climate Graph-2012';
    }

}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
export let chartData: Object[] = [
    { x: 'Jan', y: -1 },
    { x: 'Feb', y: -1 },
    { x: 'Mar', y: 2 },
    { x: 'Apr', y: 8 },
    { x: 'May', y: 13 },
    { x: 'Jun', y: 18 },
    { x: 'Jul', y: 21 },
    { x: 'Aug', y: 20 },
    { x: 'Sep', y: 16 },
    { x: 'Oct', y: 10 },
    { x: 'Nov', y: 4 },
    { x: 'Dec', y: 0 }
];

Series customization

The following properties customize the spline area series.

Solid fill

The fill property determines the color applied to the series. Default value is null.

import { ChartModule } from '@syncfusion/ej2-angular-charts'
import { CategoryService, SplineAreaSeriesService } from '@syncfusion/ej2-angular-charts'


import { Component, OnInit } from '@angular/core';
import { chartData } from './datasource';

@Component({
imports: [
         ChartModule
    ],

providers: [CategoryService, SplineAreaSeriesService],
standalone: true,
    selector: 'app-container',
    template: `<ejs-chart id="chart-container" [primaryXAxis]='primaryXAxis' [title]='title'>
        <e-series-collection>
            <e-series [dataSource]='chartData' type='SplineArea' xName='x' yName='y' name='London' width=2 [marker]='marker' fill='yellow'></e-series>
        </e-series-collection>
    </ejs-chart>`
})
export class AppComponent implements OnInit {
    public primaryXAxis?: Object;
    public chartData?: Object[];
    public title?: string;
    public marker?: Object;
    border?: Object;
    ngOnInit(): void {
        this.chartData = chartData;
        this.primaryXAxis = {
           title: 'Month',
           valueType: 'Category'
        };
        this.marker = { visible: false, width: 10, height: 10 };
        this.title = 'Climate Graph-2012';
    }

}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
export let chartData: Object[] = [
    { x: 'Jan', y: -1 },
    { x: 'Feb', y: -1 },
    { x: 'Mar', y: 2 },
    { x: 'Apr', y: 8 },
    { x: 'May', y: 13 },
    { x: 'Jun', y: 18 },
    { x: 'Jul', y: 21 },
    { x: 'Aug', y: 20 },
    { x: 'Sep', y: 16 },
    { x: 'Oct', y: 10 },
    { x: 'Nov', y: 4 },
    { x: 'Dec', y: 0 }
];

Gradient fill

The fill property can apply an SVG gradient to a spline area series. Define the gradient within an SVG <defs> element using a unique ID, and assign it to the series in the url(#gradientId) format. Place the following SVG element in your application’s index.html file, inside the <body> element and outside the <app-container> element.

<svg>
    <defs>
        <linearGradient id="gradient">
            <stop offset="0%" style="stop-color: blue; stop-opacity: 1" />
            <stop offset="50%" style="stop-color: violet; stop-opacity: 1" />
        </linearGradient>
    </defs>
</svg>
import { ChartModule } from '@syncfusion/ej2-angular-charts'
import { CategoryService, SplineAreaSeriesService } from '@syncfusion/ej2-angular-charts'


import { Component, OnInit } from '@angular/core';
import { chartData } from './datasource';

@Component({
imports: [
         ChartModule
    ],

providers: [CategoryService, SplineAreaSeriesService],
standalone: true,
    selector: 'app-container',
    template: `<ejs-chart id="chart-container" [primaryXAxis]='primaryXAxis' [title]='title'>
        <e-series-collection>
            <e-series [dataSource]='chartData' type='SplineArea' xName='x' yName='y' name='London' width=2 [marker]='marker' fill='url(#gradient)'></e-series>
        </e-series-collection>
    </ejs-chart>`
})
export class AppComponent implements OnInit {
    public primaryXAxis?: Object;
    public chartData?: Object[];
    public title?: string;
    public marker?: Object;
    ngOnInit(): void {
        this.chartData = chartData;
        this.primaryXAxis = {
           title: 'Month',
           valueType: 'Category'
        };
        this.marker = { visible: false, width: 10, height: 10 };
        this.title = 'Climate Graph-2012';
    }

}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
export let chartData: Object[] = [
    { x: 'Jan', y: -1 },
    { x: 'Feb', y: -1 },
    { x: 'Mar', y: 2 },
    { x: 'Apr', y: 8 },
    { x: 'May', y: 13 },
    { x: 'Jun', y: 18 },
    { x: 'Jul', y: 21 },
    { x: 'Aug', y: 20 },
    { x: 'Sep', y: 16 },
    { x: 'Oct', y: 10 },
    { x: 'Nov', y: 4 },
    { x: 'Dec', y: 0 }
];

Opacity

The opacity property specifies the transparency level of the fill. Valid range is 0 (completely transparent) to 1 (completely opaque). Default value is 1.

import { ChartModule } from '@syncfusion/ej2-angular-charts'
import { CategoryService, SplineAreaSeriesService } from '@syncfusion/ej2-angular-charts'


import { Component, OnInit } from '@angular/core';
import { chartData } from './datasource';

@Component({
imports: [
         ChartModule
    ],

providers: [CategoryService, SplineAreaSeriesService],
standalone: true,
    selector: 'app-container',
    template: `<ejs-chart id="chart-container" [primaryXAxis]='primaryXAxis' [title]='title'>
        <e-series-collection>
            <e-series [dataSource]='chartData' type='SplineArea' xName='x' yName='y' name='London' width=2 [marker]='marker' opacity='0.5'></e-series>
        </e-series-collection>
    </ejs-chart>`
})
export class AppComponent implements OnInit {
    public primaryXAxis?: Object;
    public chartData?: Object[];
    public title?: string;
    public marker?: Object;
    ngOnInit(): void {
        this.chartData = chartData;
        this.primaryXAxis = {
           title: 'Month',
           valueType: 'Category'
        };
        this.marker = { visible: false, width: 10, height: 10 };
        this.title = 'Climate Graph-2012';
    }

}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
export let chartData: Object[] = [
    { x: 'Jan', y: -1 },
    { x: 'Feb', y: -1 },
    { x: 'Mar', y: 2 },
    { x: 'Apr', y: 8 },
    { x: 'May', y: 13 },
    { x: 'Jun', y: 18 },
    { x: 'Jul', y: 21 },
    { x: 'Aug', y: 20 },
    { x: 'Sep', y: 16 },
    { x: 'Oct', y: 10 },
    { x: 'Nov', y: 4 },
    { x: 'Dec', y: 0 }
];

Series Border

Use the border property to style the series border. The border object supports these fields:

  • width - Border thickness in pixels.
  • color - Border stroke color.
  • dashArray - Dash pattern for the border (for example '5', '5,5', or '2,3,4').

Example: { width: 2, color: 'red', dashArray: '5,5' }.

import { ChartModule } from '@syncfusion/ej2-angular-charts'
import { CategoryService, SplineAreaSeriesService } from '@syncfusion/ej2-angular-charts'


import { Component, OnInit } from '@angular/core';
import { chartData } from './datasource';

@Component({
imports: [
         ChartModule
    ],

providers: [CategoryService, SplineAreaSeriesService],
standalone: true,
    selector: 'app-container',
    template: `<ejs-chart id="chart-container" [primaryXAxis]='primaryXAxis' [title]='title'>
        <e-series-collection>
            <e-series [dataSource]='chartData' type='SplineArea' xName='x' yName='y' name='London' width=2 [marker]='marker' [border]='border'></e-series>
        </e-series-collection>
    </ejs-chart>`
})
export class AppComponent implements OnInit {
    public primaryXAxis?: Object;
    public chartData?: Object[];
    public title?: string;
    public marker?: Object;
    public border?: Object;
    ngOnInit(): void {
        this.chartData = chartData;
        this.primaryXAxis = {
           title: 'Month',
           valueType: 'Category'
        };
        this.border = {
            width: 2, color: 'red', dashArray: '5,5'
        };
        this.marker = { visible: false, width: 10, height: 10 };
        this.title = 'Climate Graph-2012';
    }

}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
export let chartData: Object[] = [
    { x: 'Jan', y: -1 },
    { x: 'Feb', y: -1 },
    { x: 'Mar', y: 2 },
    { x: 'Apr', y: 8 },
    { x: 'May', y: 13 },
    { x: 'Jun', y: 18 },
    { x: 'Jul', y: 21 },
    { x: 'Aug', y: 20 },
    { x: 'Sep', y: 16 },
    { x: 'Oct', y: 10 },
    { x: 'Nov', y: 4 },
    { x: 'Dec', y: 0 }
];

Empty points

Data points with null or undefined values are considered empty. How an empty point is rendered on the chart depends on the mode you choose.

Mode

Use the mode property to define how empty or missing data points are handled. Available values are:

  • Gap (default) - Leaves a gap at the empty point.
  • Drop - Drops the empty point and connects adjacent points.
  • Zero - Replaces the empty point with the value 0.
  • Average - Replaces the empty point with the average of adjacent points.
import { ChartModule } from '@syncfusion/ej2-angular-charts'
import { CategoryService, SplineAreaSeriesService } from '@syncfusion/ej2-angular-charts'


import { Component, OnInit } from '@angular/core';
import { chartData } from './datasource';

@Component({
imports: [
         ChartModule
    ],

providers: [CategoryService, SplineAreaSeriesService],
standalone: true,
    selector: 'app-container',
    template: `<ejs-chart id="chart-container" [primaryXAxis]='primaryXAxis' [title]='title'>
        <e-series-collection>
            <e-series [dataSource]='chartData' type='SplineArea' xName='x' yName='y' name='London' width=2 [marker]='marker' [emptyPointSettings]='emptyPointSettings'></e-series>
        </e-series-collection>
    </ejs-chart>`
})
export class AppComponent implements OnInit {
    public primaryXAxis?: Object;
    public chartData?: Object[];
    public title?: string;
    public emptyPointSettings?: Object;
    public marker?: Object;
    border?: Object;
    ngOnInit(): void {
        this.chartData = chartData;
        this.primaryXAxis = {
           title: 'Month',
           valueType: 'Category'
        };
        this.marker = { visible: true, width: 10, height: 10 };
        this.title = 'Climate Graph-2012';
        this.emptyPointSettings= {
            mode: 'Gap'
        }
    }

}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
export let chartData: Object[] = [
    { x: 'Jan', y: -1 },
    { x: 'Feb', y: -1 },
    { x: 'Mar', y: 2 },
    { x: 'Apr', y: null },
    { x: 'May', y: 13 },
    { x: 'Jun', y: 18 },
    { x: 'Jul', y: 21 },
    { x: 'Aug', y: 20 },
    { x: 'Sep', y: undefined },
    { x: 'Oct', y: 10 },
    { x: 'Nov', y: 4 },
    { x: 'Dec', y: 0 }
];

Empty Point Fill

Use the fill property to customize the fill color of empty points in the series. Applies only when mode is Zero or Average.

import { ChartModule } from '@syncfusion/ej2-angular-charts'
import { CategoryService, SplineAreaSeriesService } from '@syncfusion/ej2-angular-charts'


import { Component, OnInit } from '@angular/core';
import { chartData } from './datasource';

@Component({
imports: [
         ChartModule
    ],

providers: [CategoryService, SplineAreaSeriesService],
standalone: true,
    selector: 'app-container',
    template: `<ejs-chart id="chart-container" [primaryXAxis]='primaryXAxis' [title]='title'>
        <e-series-collection>
            <e-series [dataSource]='chartData' type='SplineArea' xName='x' yName='y' name='London' width=2 [marker]='marker' [emptyPointSettings]='emptyPointSettings'></e-series>
        </e-series-collection>
    </ejs-chart>`
})
export class AppComponent implements OnInit {
    public primaryXAxis?: Object;
    public chartData?: Object[];
    public title?: string;
    public emptyPointSettings?: Object;
    public marker?: Object;
    ngOnInit(): void {
        this.chartData = chartData;
        this.primaryXAxis = {
           title: 'Month',
           valueType: 'Category'
        };
        this.marker = { visible: true, width: 10, height: 10 };
        this.title = 'Climate Graph-2012';
        this.emptyPointSettings= {
            mode: 'Average', fill: 'red'
        }
    }

}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
export let chartData: Object[] = [
    { x: 'Jan', y: -1 },
    { x: 'Feb', y: -1 },
    { x: 'Mar', y: 2 },
    { x: 'Apr', y: null },
    { x: 'May', y: 13 },
    { x: 'Jun', y: 18 },
    { x: 'Jul', y: 21 },
    { x: 'Aug', y: 20 },
    { x: 'Sep', y: undefined },
    { x: 'Oct', y: 10 },
    { x: 'Nov', y: 4 },
    { x: 'Dec', y: 0 }
];

Empty Point Border

Use the border property to customize the width and color of the border for empty points. Applies only when mode is Zero or Average.

import { ChartModule } from '@syncfusion/ej2-angular-charts'
import { CategoryService, SplineAreaSeriesService } from '@syncfusion/ej2-angular-charts'


import { Component, OnInit } from '@angular/core';
import { chartData } from './datasource';

@Component({
imports: [
         ChartModule
    ],

providers: [CategoryService, SplineAreaSeriesService],
standalone: true,
    selector: 'app-container',
    template: `<ejs-chart id="chart-container" [primaryXAxis]='primaryXAxis' [title]='title'>
        <e-series-collection>
            <e-series [dataSource]='chartData' type='SplineArea' xName='x' yName='y' name='London' width=2 [marker]='marker' [emptyPointSettings]='emptyPointSettings'></e-series>
        </e-series-collection>
    </ejs-chart>`
})
export class AppComponent implements OnInit {
    public primaryXAxis?: Object;
    public chartData?: Object[];
    public title?: string;
    public emptyPointSettings?: Object;
    public marker?: Object;
    ngOnInit(): void {
        this.chartData = chartData;
        this.primaryXAxis = {
           title: 'Month',
           valueType: 'Category'
        };
        this.marker = { visible: true, width: 10, height: 10 };
        this.title = 'Climate Graph-2012';
        this.emptyPointSettings= {
            mode: 'Average', fill: 'red', border: {width: 2, color: 'green'}
        }
    }

}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
export let chartData: Object[] = [
    { x: 'Jan', y: -1 },
    { x: 'Feb', y: -1 },
    { x: 'Mar', y: 2 },
    { x: 'Apr', y: null },
    { x: 'May', y: 13 },
    { x: 'Jun', y: 18 },
    { x: 'Jul', y: 21 },
    { x: 'Aug', y: 20 },
    { x: 'Sep', y: undefined },
    { x: 'Oct', y: 10 },
    { x: 'Nov', y: 4 },
    { x: 'Dec', y: 0 }
];

Events

Series render

The seriesRender event allows you to customize series properties, such as data, fill, and name, before they are rendered on the chart. The handler in the included snippet assigns args.fill = '#ff6347', applying a tomato color to the series before render.

import { ChartModule } from '@syncfusion/ej2-angular-charts'
import { ISeriesRenderEventArgs } from '@syncfusion/ej2-charts'
import { CategoryService, SplineAreaSeriesService } from '@syncfusion/ej2-angular-charts'


import { Component, OnInit } from '@angular/core';
import { chartData } from './datasource';

@Component({
imports: [
         ChartModule
    ],

providers: [CategoryService, SplineAreaSeriesService],
standalone: true,
    selector: 'app-container',
    template: `<ejs-chart id="chart-container" (seriesRender)='seriesRender($event)' [primaryXAxis]='primaryXAxis' [title]='title'>
        <e-series-collection>
            <e-series [dataSource]='chartData' type='SplineArea' xName='x' yName='y' name='London' width=2 [marker]='marker'></e-series>
        </e-series-collection>
    </ejs-chart>`
})
export class AppComponent implements OnInit {
    public primaryXAxis?: Object;
    public chartData?: Object[];
    public title?: string;
    public marker?: Object;
    ngOnInit(): void {
        this.chartData = chartData;
        this.primaryXAxis = {
           title: 'Month',
           valueType: 'Category'
        };
        this.marker = { visible: false, width: 10, height: 10 };
        this.title = 'Climate Graph-2012';
    }
    public seriesRender(args: ISeriesRenderEventArgs){
        args.fill = '#ff6347';
    }
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
export let chartData: Object[] = [
    { x: 'Jan', y: -1 },
    { x: 'Feb', y: -1 },
    { x: 'Mar', y: 2 },
    { x: 'Apr', y: 8 },
    { x: 'May', y: 13 },
    { x: 'Jun', y: 18 },
    { x: 'Jul', y: 21 },
    { x: 'Aug', y: 20 },
    { x: 'Sep', y: 16 },
    { x: 'Oct', y: 10 },
    { x: 'Nov', y: 4 },
    { x: 'Dec', y: 0 }
];

Point render

The pointRender event allows you to customize each data point before it is rendered on the chart. The handler in the included snippet assigns args.fill = 'red' on every point before render.

import { ChartModule } from '@syncfusion/ej2-angular-charts'
import { IPointRenderEventArgs } from '@syncfusion/ej2-charts'
import { CategoryService, SplineAreaSeriesService } from '@syncfusion/ej2-angular-charts'


import { Component, OnInit } from '@angular/core';
import { chartData } from './datasource';

@Component({
imports: [
         ChartModule
    ],

providers: [CategoryService, SplineAreaSeriesService],
standalone: true,
    selector: 'app-container',
    template: `<ejs-chart id="chart-container" (pointRender)='pointRender($event)' [primaryXAxis]='primaryXAxis' [title]='title'>
        <e-series-collection>
            <e-series [dataSource]='chartData' type='SplineArea' xName='x' yName='y' name='London' width=2 [marker]='marker'></e-series>
        </e-series-collection>
    </ejs-chart>`
})
export class AppComponent implements OnInit {
    public primaryXAxis?: Object;
    public chartData?: Object[];
    public title?: string;
    public marker?: Object;
    ngOnInit(): void {
        this.chartData = chartData;
        this.primaryXAxis = {
           title: 'Month',
           valueType: 'Category'
        };
        this.marker = { visible: true, width: 10, height: 10 };
        this.title = 'Climate Graph-2012';
    }
    public pointRender(args: IPointRenderEventArgs){
            args.fill = 'red';
    }
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
export let chartData: Object[] = [
    { x: 'Jan', y: -1 },
    { x: 'Feb', y: -1 },
    { x: 'Mar', y: 2 },
    { x: 'Apr', y: 8 },
    { x: 'May', y: 13 },
    { x: 'Jun', y: 18 },
    { x: 'Jul', y: 21 },
    { x: 'Aug', y: 20 },
    { x: 'Sep', y: 16 },
    { x: 'Oct', y: 10 },
    { x: 'Nov', y: 4 },
    { x: 'Dec', y: 0 }
];

Troubleshooting

  • Ensure SplineAreaSeriesService is registered in the providers; otherwise the spline area series will not render.
  • Gradient fill renders as solid color: the SVG gradient referenced by fill='url(#gradient)' is not defined. Add a matching <linearGradient> (or <radialGradient>) inside a <defs> block in the chart template, or in a global stylesheet.
  • Border property does not show a dash pattern: the included snippet uses dashArray='5,5' inside the border object literal — this is valid syntax. If you build the object programmatically, use a colon (dashArray: '5,5') instead of an equals sign.
  • Empty-point customization has no visible effect: the fill and border settings on emptyPointSettings apply only when mode is Zero or Average. With Gap and Drop modes no marker is drawn.

See Also