Step Line Chart
The Ignite UI for React step line chart belongs to a group of category charts and it is rendered using a collection of points connected by continuous vertical and horizontal lines forming a step-like progression. Values are represented on the y-axis and categories are displayed on the x-axis. IgrStepLineSeries emphasizes the amount of change over a period of time or compares multiple items. The React step line chart is identical to the React step area chart in all aspects except that the area below the step lines is not filled in.
Demo
Required Axes
The React data chart component provides various types of axes but only the following types of axes can be used with IgrStepLineSeries.
Required Data
The IgrStepLineSeries 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
IgrStepLineSeries. - 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 theIgrStepLineSeries.
You can use the SampleCategoryData as data source which meets above data requirements.
public dataSource: any[] = SampleCategoryData.create();
Required Modules
Creation of the IgrStepLineSeries requires the following modules:
// axis' modules:
import { IgrNumericYAxis } from 'igniteui-react-charts';
import { IgrCategoryXAxis } from 'igniteui-react-charts';
// series' modules:
import { IgrStepLineSeries } 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 IgrStepLineSeries and bind it to a data source.
<IgrDataChart
dataSource={this.dataSource}
width="700px"
height="500px">
{/* axes */}
<IgrCategoryXAxis name="xAxis" label="Year" />
<IgrNumericYAxis name="yAxis" />
{/* series */}
<IgrStepLineSeries
name="series1"
xAxisName="xAxis"
yAxisName="yAxis"
valueMemberPath="USA" />
</IgrDataChart>
const series1 = new IgrStepLineSeries({ 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);