Stacked 100 Line Chart
The Ignite UI for Angular stacked 100 line chart belongs to a group of category charts and is rendered using a collection of points connected by line segments (IgxStackedFragmentSeriesComponent) that are stacked on top of each other. Each stacked fragment in the collection represents one visual element in each stack. Each stack can contain both positive and negative values. All positive values are grouped on the positive side of the y-axis, and all negative values are grouped on the negative side of the y-axis. The Angular stacked 100 line chart is identical to the Angular stacked line chart in all aspects except in their treatment of the values on y-axis. Instead of presenting a direct representation of the data, the IgxStacked100LineSeriesComponent presents the data in terms of percent of the sum of all values in a data point.
Demo
The IgxStacked100LineSeriesComponent has its own IgxSeriesComponent collection in which you can place the IgxStackedFragmentSeriesComponent elements. These fragments are what make up the actual rendering of the chart and are the elements that accept the valueMemberPath.
Required Axes
The Angular data chart component provides various types of axes but only the following types of axes can be used with IgxStacked100LineSeriesComponent.
IgxCategoryXAxisComponentIgxOrdinalTimeXAxisComponentIgxTimeXAxisComponentIgxNumericYAxisComponent
Required Data
The IgxStacked100LineSeriesComponent 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
IgxStacked100LineSeriesComponent. - All data items must contain at least one 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 one numeric data column which should be mapped using the
ValueMemberPathproperty of theIgxStackedFragmentSeriesComponentto be added to theIgxStacked100LineSeriesComponent'IgxSeriesComponentcollection.
Required Modules
Creation of the IgxStacked100LineSeriesComponent requires the following modules:
// 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 { IgxStacked100LineSeries } from "igniteui-angular-charts/ES5/igx-stacked-100-line-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";
import { IgxDataChartStackedModule } from "igniteui-angular-charts/ES5/igx-data-chart-stacked-module";
@NgModule({
imports: [
// ...
IgxDataChartCoreModule,
IgxDataChartCategoryModule,
IgxDataChartStackedModule
// ...
]
})
Code Example - Stacked 100 Line Chart
This code demonstrates how to create an instance of the Ignite UI for Angular data chart with IgxStacked100LineSeriesComponent and bind it to a data source.
<igx-data-chart #chart height="100%" width="100%" [dataSource]="data">
<igx-category-x-axis #xAxis label="Country"></igx-category-x-axis>
<igx-numeric-y-axis #yAxis></igx-numeric-y-axis>
<igx-stacked-100-line-series [xAxis]="xAxis" [yAxis]="yAxis">
<igx-stacked-fragment-series valueMemberPath="Coal"></igx-stacked-fragment-series>
<igx-stacked-fragment-series valueMemberPath="Hydro"></igx-stacked-fragment-series>
<igx-stacked-fragment-series valueMemberPath="Nuclear"></igx-stacked-fragment-series>
<igx-stacked-fragment-series valueMemberPath="Gas"></igx-stacked-fragment-series>
<igx-stacked-fragment-series valueMemberPath="Oil"></igx-stacked-fragment-series>
</igx-stacked-100-line-series>
</igx-data-chart>