Step Line Chart
- 3 minutes to read
Short Description
A StepLineSeriesView object is used to display the Step Line Chart. This chart type belongs to the Point, Line and Spline Series View type. This view allows you to highlight the difference between adjacent series point values. Also, you can set the StepLineSeriesView.InvertedStep property to true
to specify whether or not these steps are displayed as inverted.
A Step Line chart is shown in the image below. Note that this chart type is based upon the XYDiagram, so it can be rotated to show lines either vertically or horizontally.
Chart Type Characteristics
The table below lists the main characteristics of this chart type.
Feature | Value |
---|---|
Series View type | StepLineSeriesView |
Diagram type | 2D-XYDiagram |
Number of arguments per series point | 1 |
Number of values per series point | 1 |
Note
For information on which chart types can be combined with the Step Line Chart, refer to the following help topic: Combining Different Series Views.
Example
The following example creates a ChartControl with a series of the StepLineSeriesView type, and adds this chart to a form at runtime. Before proceeding with this example, first create a Windows Forms Application in Visual Studio, and add all required assemblies to the project’s References list.
Then, add the following code to the Form.Load event handler.
using System;
using System.Windows.Forms;
using DevExpress.XtraCharts;
// ...
private void Form1_Load(object sender, EventArgs e) {
// Create a new chart.
ChartControl stepLineChart = new ChartControl();
// Create a step line series.
Series series1 = new Series("Series 1", ViewType.StepLine);
// Add points to it.
series1.Points.Add(new SeriesPoint("A", 12));
series1.Points.Add(new SeriesPoint("B", 4));
series1.Points.Add(new SeriesPoint("C", 17));
series1.Points.Add(new SeriesPoint("D", 7));
series1.Points.Add(new SeriesPoint("E", 12));
series1.Points.Add(new SeriesPoint("F", 4));
series1.Points.Add(new SeriesPoint("G", 17));
series1.Points.Add(new SeriesPoint("H", 7));
// Add the series to the chart.
stepLineChart.Series.Add(series1);
// Customize the view-type-specific properties of the series.
StepLineSeriesView myView = (StepLineSeriesView)series1.View;
myView.LineMarkerOptions.Kind = MarkerKind.Star;
myView.LineMarkerOptions.StarPointCount = 5;
myView.LineStyle.DashStyle = DashStyle.Dash;
// Access the diagram's options.
((XYDiagram)stepLineChart.Diagram).EnableAxisXZooming = true;
// Hide the legend (if necessary).
stepLineChart.Legend.Visible = false;
// Add a title to the chart (if necessary).
stepLineChart.Titles.Add(new ChartTitle());
stepLineChart.Titles[0].Text = "A Step Line Chart";
// Add the chart to the form.
stepLineChart.Dock = DockStyle.Fill;
this.Controls.Add(stepLineChart);
}