Stacked 100 Bar Chart

The Ignite UI for Angular stacked 100 bar chart belongs to a group of category charts and is rendered using a collection of rectangles (IgxStackedFragmentSeriesComponent) that are stacked next to 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 x-axis, and all negative values are grouped on the negative side of the x-axis. The Angular stacked 100 bar chart is identical to the Angular stacked bar chart in all aspects except in their treatment of the values on x-axis. Instead of presenting a direct representation of the data, the stacked 100 bar chart presents the data in terms of percent of the sum of all values in a data point. In addition, the IgxStacked100BarSeriesComponent uses the same concepts of data plotting as IgxStacked100ColumnSeriesComponent but data points are stacked along horizontal line (x-axis) rather than along vertical line (y-axis). In other words, the stacked 100 bar chart is rendered like the stacked 100 column chart but with 90 degrees clockwise rotation.

Demo

The IgxStacked100BarSeriesComponent 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 IgxStacked100BarSeriesComponent.

Required Data

The IgxStacked100BarSeriesComponent has the following data requirements:

Required Modules

Creation of the IgxStacked100BarSeriesComponent requires the following modules:

// axis' modules:
import { IgxNumericXAxis } from 'igniteui-angular-charts';
import { IgxCategoryYAxis } from 'igniteui-angular-charts';
// series' modules:
import { IgxStacked100BarSeries } from 'igniteui-angular-charts';
// data chart's modules:

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

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

Code Example

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

<igx-data-chart #chart height="100%" width="100%" [dataSource]="data">
  <igx-numeric-x-axis #xAxis></igx-numeric-x-axis>
  <igx-category-y-axis #yAxis label="Country"></igx-category-y-axis>

  <igx-stacked-100-bar-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-bar-series>

</igx-data-chart>