Step Line Chart

Overview

A step line chart is a line chart in which points are connected by horizontal and vertical line segments, looking like steps of a staircase.

Step line charts are used when it is necessary to highlight the irregularity of changes: for example, when changes in tax rates or interest rates are visualized. While the line chart emphasizes the trend in data over time, the step line chart draws attention from the trend to show periods with no change and emphasize the exact time of each change as well as its magnitude.

The Step Line and Line chart types share almost all the settings, so this article explains just how to create a basic Step Line chart and configure its only special setting – step direction. To learn about other settings, read the Line Chart article. You can also see the table below to get a brief overview of the Step Line chart's characteristics:

API
Classanychart.core.cartesian.series.StepLine
DATA
Data Fieldsx, value
Multiple SeriesYES
OPTIONS
StackedN/A
VerticalVertical Step Line
3DN/A
Error BarsStep Line Chart with Error Bars
SUPPORTED CHART PLOTS
PolarN/A
RadarN/A
ScatterN/A
StockStock Step Line
RELATED TYPES
Line
Spline
SEE ALSO
Chartopedia: Step Line Chart
General Settings

Quick Start

To create a Step Line series, use the stepLine() method (before, of course, you should create a chart by using anychart.line() or any other cartesian chart constructor):

// create data
var data = [
  {x: "1995", value: 0.10},
  {x: "1996", value: 0.10},
  {x: "1997", value: 0.12},
  {x: "1998", value: 0.13},
  {x: "1999", value: 0.15},
  {x: "2000", value: 0.15},
  {x: "2001", value: 0.15},
  {x: "2002", value: 0.19},
  {x: "2003", value: 0.20}
];

// create a chart
var chart = anychart.line();

// create a step line series and set the data
var series = chart.stepLine(data);

// set step direction to the forward mode
series.stepDirection("forward");

// set the container id
chart.container("container");

// initiate drawing the chart
chart.draw();

Playground

Settings

The Step Line chart is a modification of the Line chart, so these two types share almost all the settings. You can find more settings in this article: Line Chart.

Also, in AnyChart there are many settings that are configured in the same way for all chart types, including the Step Line chart (for example, legend and interactivity settings): General Settings.

In addition, see the full list of methods available for the Step Line series: anychart.core.cartesian.series.StepLine.

Special Settings

Step Direction

The Step Line chart is formed by horizontal line segments of the same width as the category, connected with each other by vertical segments. To set the exact way these segments are placed, use this method: stepDirection().

There are three modes of step direction: center, backward, and forward. The default mode is center (in this case data points are placed to the center of horizontal segments).

In the forward mode data points are the starting points of horizontal segments:

// set step direction to the forward mode
series.stepDirection("forward");

Playground

The backward mode sets data points as the final points of horizontal segments:

// set step direction to the backward mode
series.stepDirection("backward");

Playground

You are looking at an outdated v7 version of this document. Switch to the v8 version to see the up to date information.