Spline Area Chart
The Ignite UI for Web Components 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. IgcSplineAreaSeriesComponent 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 Web Components spline area chart is identical to the Web Components 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 Web Components data chart component provides various types of axes but only the following types of axes can be used with IgcSplineAreaSeriesComponent.
IgcCategoryXAxisComponentIgcOrdinalTimeXAxisComponentIgcTimeXAxisComponentIgcNumericYAxisComponent
Required Data
The IgcSplineAreaSeriesComponent 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
IgcSplineAreaSeriesComponent. - 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 theIgcSplineAreaSeriesComponent.
You can use the SampleCategoryData as data source which meets above data requirements.
public dataSource: any[] = SampleCategoryData.create();
Required Modules
Creation of the IgcSplineAreaSeriesComponent 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 { IgcSplineAreaSeriesModule } from 'igniteui-webcomponents-charts';
//series' components
import { IgcSplineAreaSeriesComponent } from 'igniteui-webcomponents-charts';
// data chart component
import { IgcDataChartComponent } from 'igniteui-webcomponents-charts';
// registering the modules:
ModuleManager.register(
IgcDataChartCoreModule,
IgcDataChartInteractivityModule,
IgcDataChartCategoryCoreModule,
IgcDataChartCategoryModule,
IgcSplineAreaSeriesModule,
);
Code Example
This code demonstrates how to create an instance of the Ignite UI for Web Components data chart with IgcSplineAreaSeriesComponent 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-spline-area-series
id="series1"
x-axis-name="xAxis"
y-axis-name="yAxis"
valueMemberPath="USA">
</igc-spline-area-series>
</igc-data-chart>
let chart = (document.getElementById("chart") as IgcDataChartComponent);
chart.dataSource = data;