Area Chart

The Ignite UI for Angular area chart belongs to a group of category charts and is rendered using a collection of points connected by line segments with the area below the line filled in. Values are represented on the y-axis and categories are displayed on the x-axis. IgxAreaSeriesComponent emphasizes the amount of change over a period of time or compares multiple items as well as the relationship of parts to a whole by displaying the total of the plotted values. The Angular area chart is identical to the Angular spline area chart in all aspects except that line connecting data points do not have spline interpolation and smoothing for improved presentation of data.

Demo

Required Axes

The Angular data chart component provides various types of axes but only the following types of axes can be used with IgxAreaSeriesComponent.

Required Data

The IgxAreaSeriesComponent has the following data requirements:

  • The data source must be an array or a list of data items.
  • The data source must contain at least one data item otherwise the chart will not render the IgxAreaSeriesComponent.
  • All data items must contain at least one data column (string or date time) which should be mapped to the Label property of the category axis (e.g. IgxCategoryXAxisComponent)
  • All data items must contain at least one numeric data column which should be mapped using the ValueMemberPath property of the IgxAreaSeriesComponent.

You can use the SampleCategoryData as data source which meets above data requirements.

public dataSource: any[] = SampleCategoryData.create();

Required Modules

Creation of the IgxAreaSeriesComponent requires the following modules:

// axis' modules:
import { IgxCategoryXAxis } from 'igniteui-angular-charts';
import { IgxNumericYAxis } from 'igniteui-angular-charts';
// series' modules:
import { IgxAreaSeries } from 'igniteui-angular-charts';
// data chart's modules:

import { IgxDataChartCoreModule } from 'igniteui-angular-charts';
import { IgxDataChartCategoryModule } from 'igniteui-angular-charts';

@NgModule({
    imports: [
        // ...
        IgxDataChartCoreModule,
        IgxDataChartCategoryModule,
        // ...
    ]
})

Code Example

This code demonstrates how to create an instance of the Ignite UI for Angular data chart with IgxAreaSeriesComponent and bind it to a data source.

 <igx-data-chart
    [dataSource]="dataSource"
    width="700px"
    height="500px">
    <igx-category-x-axis name="xAxis" label="Year"></igx-category-x-axis>
    <igx-numeric-y-axis  name="yAxis"></igx-numeric-y-axis>
    <igx-area-series
        name="series1"
        xAxisName="xAxis"
        yAxisName="yAxis"
        valueMemberPath="USA">
    </igx-area-series>
 </igx-data-chart>

Additional Resources