Waterfall Chart
The Ignite UI for Web Components waterfall chart belongs to a group of category charts and it is rendered using a collection of vertical columns that show the difference between consecutive data points. The columns are color coded for distinguishing between positive and negative changes in value. Values are represented on the y-axis and categories are displayed on the x-axis. The Web Components IgcWaterfallSeriesComponent is similar in appearance to the Web Components IgcRangeColumnSeriesComponent but it requires only one numeric data column rather than two columns for each data point.
Demo
Required Axes
The Web Components data chart component provides various types of axes but only the following types of axes can be used with IgcWaterfallSeriesComponent.
IgcCategoryXAxisComponentIgcOrdinalTimeXAxisComponentIgcTimeXAxisComponentIgcNumericYAxisComponent
Required Data
The IgcWaterfallSeriesComponent 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
IgcWaterfallSeriesComponent. - 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.IgcCategoryXAxisComponent) - All data items must contain at least one numeric data column which should be mapped using the
ValueMemberPathproperty of theIgcWaterfallSeriesComponent.
You can use the SampleCategoryData as data source which meets above data requirements.
public dataSource: any[] = SampleCategoryData.create();
Required Modules
Creation of the IgcWaterfallSeriesComponent requires the following modules:
// Module Manager:
import { ModuleManager } from 'igniteui-webcomponents-core';
// data chart's modules:
import { IgcDataChartCoreModule } from 'igniteui-webcomponents-charts';
import { IgcDataChartInteractivityModule } from 'igniteui-webcomponents-charts';
import { IgcDataChartCategoryCoreModule } from 'igniteui-webcomponents-charts';
import { IgcDataChartCategoryModule } from 'igniteui-webcomponents-charts';
// axis' modules:
import { IgcNumericYAxisModule } from 'igniteui-webcomponents-charts';
import { IgcNumericXAxisModule } from 'igniteui-webcomponents-charts';
import { IgcCategoryXAxisModule } from 'igniteui-webcomponents-charts';
import { IgcCategoryYAxisModule } from 'igniteui-webcomponents-charts';
// axis' components:
import { IgcNumericYAxisComponent } from 'igniteui-webcomponents-charts';
import { IgcNumericXAxisComponent } from 'igniteui-webcomponents-charts';
import { IgcCategoryXAxisComponent } from 'igniteui-webcomponents-charts';
import { IgcCategoryYAxisComponent } from 'igniteui-webcomponents-charts';
// series' modules:
import { IgcWaterfallSeriesModule } from 'igniteui-webcomponents-charts';
//series' components
import { IgcWaterfallSeriesComponent } from 'igniteui-webcomponents-charts';
// data chart component
import { IgcDataChartComponent } from 'igniteui-webcomponents-charts';
// registering the modules:
ModuleManager.register(
IgcDataChartCoreModule,
IgcDataChartInteractivityModule,
IgcDataChartCategoryCoreModule,
IgcDataChartCategoryModule,
IgcWaterfallSeriesModule
);
Code Example
This code demonstrates how to create an instance of the Ignite UI for Web Components data chart with IgcWaterfallSeriesComponent and bind it to a data source.
<igc-data-chart id="chart"
width="700px"
height="500px">
<igc-category-x-axis id="xAxis" label="Year"></igc-category-x-axis>
<igc-numeric-y-axis id="yAxis"></igc-numeric-y-axis>
<igc-waterfall-series
id="series1"
x-axis-name="xAxis"
y-axis-name="yAxis"
valueMemberPath="USA">
</igc-waterfall-series>
</igc-data-chart>
let chart = (document.getElementById("chart") as IgcDataChartComponent);
chart.dataSource = data;