Spline Area Chart

The Ignite UI for React spline area chart belongs to a group of category charts and it is rendered using a collection of points connected by smooth curves of spline with the area below the spline filled in. Values are represented on the y-axis and categories are displayed on the x-axis. IgrSplineAreaSeries emphasizes the amount of change over a period of time or compares multiple items as well as the relationship of parts to a whole by displaying the total of the plotted values. The React spline area chart is identical to the React area chart in all aspects except that line connecting data points has spline interpolation and smoothing for improved presentation of data.

Demo

Required Axes

The React data chart component provides various types of axes but only the following types of axes can be used with IgrSplineAreaSeries.

Required Data

The IgrSplineAreaSeries 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 IgrSplineAreaSeries.
  • All data items must contain at least one data column (string or date time) which should be mapped to the Label property of the category axis (e.g. IgrCategoryXAxis)
  • All data items must contain at least one numeric data column which should be mapped using the ValueMemberPath property of the IgrSplineAreaSeries.

You can use the SampleCategoryData as data source which meets above data requirements.

public dataSource: any[] = SampleCategoryData.create();

Required Modules

Creation of the IgrSplineAreaSeries requires the following modules:

// axis' modules:
import { IgrNumericYAxis } from 'igniteui-react-charts';
import { IgrCategoryXAxis } from 'igniteui-react-charts';
// series' modules:
import { IgrSplineAreaSeries } 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 IgrSplineAreaSeries 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 */}
    <IgrSplineAreaSeries
        name="series1"
        xAxisName="xAxis"
        yAxisName="yAxis"
        valueMemberPath="USA" />
 </IgrDataChart>
const series1 = new IgrSplineAreaSeries({ 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);

Additional Resources