AnyStock Step Line Series

Overview

Step Line Series is rather similar to Line Series. Find all information about using Step Lines in the Step Line Chart tutorial.

AnyStock Step Line Series Adjustment

Data

The data in stocks should be formatted as a table, there are two ways of setting it: as an array of arrays or as an array of objects.

Here is how to set data as an array of arrays, array contains values and then you map the data set to tell the component which column contains values.

// set the data
table = anychart.data.table();
table.addData([
	['2004-01-02', 29955800],
	['2004-01-05', 38892100],
	['2004-01-06', 43684400],
	['2004-01-07', 48757500],
	['2004-01-08', 61683300],
	['2004-01-09', 68856400],
	['2004-01-12', 52871900],
	['2004-01-13', 56334200]
]);

// map the data
mapping = table.mapAs();
mapping.addField('value', 1);

JsFiddle Playground

// set the data
table = anychart.data.table('x');
table.addData([
	{'x':'2004-01-02', 'value': 29955800},
	{'x':'2004-01-05', 'value': 38892100},
	{'x':'2004-01-06', 'value': 43684400},
	{'x':'2004-01-07', 'value': 48757500},
	{'x':'2004-01-08', 'value': 61683300},
	{'x':'2004-01-09', 'value': 68856400},
	{'x':'2004-01-12', 'value': 52871900},
	{'x':'2004-01-13', 'value': 56334200}
]);

// map the data
mapping = table.mapAs({x: 'x', value: 'value'});	

JsFiddle Playground

You can read more about managing Data in Stocks in the Stock Data tutorial.

Multi series

This sample shows a simple multi-series Step Line stock.

// set the series
var series_total = chart.plot(0).stepLine(mapping_total);
series_total.name("Total Request Number");
var series_region = chart.plot(0).stepLine(mapping_region);
series_region.name("Region Request Number");

JsFiddle Playground

Now look at the next sample, where the series are put in the different plots.

// set the series
var series_total = chart.plot(0).stepLine(mapping_total);
series_total.name("Total Request Number");
var series_region = chart.plot(1).stepLine(mapping_region);
series_region.name("Region Request Number");

JsFiddle Playground

Note that the only thing you need to do to put a series in a new plot is to set the new plot ID as a parameter of the plot() method.

More about plots can be found in the Plots tutorial.

Switching series type

You can change the type of series to another compatible type. See the Series Type and series types table.

To switch the series use seriesType() method.

Appearance

To change the stroke color use the stroke() method.

// coloring
series_total.stroke("#ff0000");

JsFiddle Playground