Waterfall Chart
The Ignite UI for React 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 React IgrWaterfallSeries is similar in appearance to the React IgrRangeColumnSeries but it requires only one numeric data column rather than two columns for each data point.
Demo
Required Axes
The React data chart component provides various types of axes but only the following types of axes can be used with IgrWaterfallSeries.
Required Data
The IgrWaterfallSeries 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
IgrWaterfallSeries. - 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.IgrCategoryXAxis) - All data items must contain at least one numeric data column which should be mapped using the
ValueMemberPathproperty of theIgrWaterfallSeries.
You can use the SampleCategoryData as data source which meets above data requirements.
public dataSource: any[] = SampleCategoryData.create();
Required Modules
Creation of the IgrWaterfallSeries requires the following modules:
// axis' modules:
import { IgrNumericYAxis } from 'igniteui-react-charts';
import { IgrCategoryXAxis } from 'igniteui-react-charts';
// series' modules:
import { IgrWaterfallSeries } from 'igniteui-react-charts';
// data chart's modules:
import { IgrDataChart } from 'igniteui-react-charts';
import { IgrDataChartCoreModule } from 'igniteui-react-charts';
import { IgrDataChartCategoryModule } from 'igniteui-react-charts';
// registering data chart's modules:
IgrDataChartCoreModule.register();
IgrDataChartCategoryModule.register();
Code Example
This code demonstrates how to create an instance of the Ignite UI for React data chart with IgrWaterfallSeries and bind it to a data source.
<IgrDataChart
dataSource={this.state.dataSource}
width="700px"
height="500px">
{/* axes */}
<IgrCategoryXAxis name="xAxis" label="Year" />
<IgrNumericYAxis name="yAxis" />
{/* series */}
<IgrWaterfallSeries
name="series1"
xAxisName="xAxis"
yAxisName="yAxis"
valueMemberPath="USA" />
</IgrDataChart>
const series1 = new IgrWaterfallSeries({ name: "series1" });
series1.valueMemberPath = "USA";
series1.xAxisName = "xAxis";
series1.yAxisName = "yAxis";
const yAxis = new IgrNumericYAxis({ name: "yAxis" });
const xAxis = new IgrCategoryXAxis({ name: "xAxis" });
xAxis.label = "Year";
this.chart = new IgrDataChart({ name: "chart" });
this.chart.dataSource = SampleCategoryData.create();
this.chart.axes.add(yAxis);
this.chart.axes.add(xAxis);
this.chart.series.add(series1);