Range Area Chart
The Ignite UI for Angular range area chart belongs to a group of range charts and is rendered using two lines with the area between the lines filled in. This type of series emphasizes the amount of change between low values and high values in the same data point over a period of time or compares multiple items. Range values are represented on the y-axis and categories are displayed on the x-axis. The IgxRangeAreaSeriesComponent is identical to the IgxRangeColumnSeriesComponent in all aspects except that the ranges are represented as filled area rather than a set of vertical columns.
Demo
Required Axes
The Angular data chart component provides various types of axes but only the following types of axes can be used with IgxRangeAreaSeriesComponent:
IgxCategoryXAxisComponentIgxOrdinalTimeXAxisComponentIgxTimeXAxisComponentIgxNumericYAxisComponent
Required Data
The IgxRangeAreaSeriesComponent 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
IgxRangeAreaSeriesComponent. - All data items must contain at least one label data column (string or date time) which should be mapped to the
Labelproperty of the category axis (e.g.IgxCategoryXAxisComponent). - All data items must contain at least two numeric data column which should be mapped using the
HighMemberPathandLowMemberPathproperties of theIgxRangeAreaSeriesComponent.
You can use the SampleRangeData as data source which meets above data requirements.
this.chart.dataSource = SampleRangeData.create();
Required Modules
Creation of the IgxRangeAreaSeriesComponent requires the following modules:
// in app.module.ts file
// axis' modules:
import { IgxCategoryXAxis } from "igniteui-angular-charts/ES5/igx-category-x-axis";
import { IgxNumericYAxis } from "igniteui-angular-charts/ES5/igx-numeric-y-axis";
// series' modules:
import { IgxRangeAreaSeries } from "igniteui-angular-charts/ES5/igx-range-area-series";
// data chart's modules:
import { IgxDataChartCoreModule } from "igniteui-angular-charts/ES5/igx-data-chart-core--module";
import { IgxDataChartCategoryModule } from "igniteui-angular-charts/ES5/igx-data-chart-category--module";
@NgModule({
imports: [
// ...
IgxDataChartCoreModule,
IgxDataChartCategoryModule,
// ...
]
})
Code Example - Range Area Chart
This code demonstrates how to create an instance of the Ignite UI for Angular data chart with IgxRangeAreaSeriesComponent 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-range-area-series
name="series1"
xAxisName="xAxis"
yAxisName="yAxis"
highMemberPath="High"
lowMemberPath="Low">
</igx-range-area-series>
</igx-data-chart>