Stacked 100 Spline Area Chart
The Ignite UI for React stacked 100 spline area chart belongs to a group of category charts and is rendered using a collection of points connected by smooth curves of spline segments (IgrStackedFragmentSeries) with the area below the spline filled in and 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 React stacked 100 spline area chart is identical to the React stacked spline area chart in all aspects except in their treatment of the values on y-axis. Instead of presenting a direct representation of the data, the IgrStacked100SplineAreaSeries presents the data in terms of percent of the sum of all values in a data point.
Demo
The IgrStacked100SplineAreaSeries has its own IgrSeries collection in which you can place the IgrStackedFragmentSeries elements. These fragments are what make up the actual rendering of the chart and are the elements that accept the valueMemberPath.
Required Axes
The React data chart component provides various types of axes but only the following types of axes can be used with IgrStacked100SplineAreaSeries.
Required Data
The IgrStacked100SplineAreaSeries 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
IgrStacked100SplineAreaSeries. - 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 theIgrStackedFragmentSeriesto be added to theIgrStacked100SplineAreaSeries'IgrSeriescollection.
Required Modules
Creation of the IgrStacked100SplineAreaSeries requires the following modules:
// axis' modules:
import { IgrCategoryXAxis } from 'igniteui-react-charts';
import { IgrNumericYAxis } from 'igniteui-react-charts';
// series' modules:
import { IgrStacked100SplineAreaSeries } 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';
import { IgrDataChartStackedModule } from 'igniteui-react-charts';
import { IgrColumnFragmentModule } from 'igniteui-react-charts' ;
// registering data chart's modules:
IgrDataChartCoreModule.register();
IgrDataChartCategoryModule.register();
IgrDataChartStackedModule.register();
IgrColumnFragmentModule.register();
This code demonstrates how to create an instance of the Ignite UI for React data chart with IgrStacked100SplineAreaSeries and bind it to a data source.
<IgrDataChart width="100%"
height="100%"
dataSource={this.data} >
<IgrCategoryXAxis name="xAxis" label="Country" />
<IgrNumericYAxis name="yAxis" minimumValue={0} />
<IgrStacked100SplineAreaSeries name="series" xAxisName="xAxis" yAxisName="yAxis">
<IgrStackedFragmentSeries name="coal" valueMemberPath="Coal" title="Coal" />
<IgrStackedFragmentSeries name="hydro" valueMemberPath="Hydro" title="Hydro" />
<IgrStackedFragmentSeries name="nuclear" valueMemberPath="Nuclear" title="Nuclear" />
<IgrStackedFragmentSeries name="gas" valueMemberPath="Gas" title="Gas" />
<IgrStackedFragmentSeries name="oil" valueMemberPath="Oil" title="Oil" />
</IgrStacked100SplineAreaSeries>
</IgrDataChart>
const stack = new IgrStacked100SplineAreaSeries({ name: "series" });
stack.xAxisName = "xAxis";
stack.yAxisName = "yAxis";
const propertyNames: string[] = ["Coal", "Hydro", "Nuclear", "Gas", "Oil"];
for (const propertyName of propertyNames) {
const fragment = new IgrStackedFragmentSeries();
fragment.valueMemberPath = propertyName;
fragment.title = propertyName;
stack.series.add(fragment);
}
const yAxis = new IgrNumericYAxis({ name: "yAxis" });
const xAxis = new IgrCategoryXAxis({ name: "xAxis" });
xAxis.label = "Country";
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(stack);