Creating Series
Overview
Series is a visual representation of the data provider on the chart. Several
series can show the same data provider in different way (for example as a Line and as an Area) and in different
charts. There are several types of series and each of them has the list of required named fields that should be
declared in data provider.
AnyChart Stock supports several types of series, each chart can contain one or several series and there is no limitation on the number of series, but it is not recommended to use more than ten series on one chart because the large number of series make your charts unreadable.
Adding Series
You can add series to the chart only when its Data Provider is ready, and there is a Data Set, which contains
data for Data Provider.
See below a sample series definition XML:
Please note that this XML doesn't show data set and data provider definition.
01 |
<?xml version="1.0" encoding="UTF-8"?> |
02 |
< stock xmlns = "http://anychart.com/products/stock/schemas/1.9.0/schema.xsd" > |
<series> node has the following required attributes:
Attributes |
Description |
type |
Series type. AnyChart Stock Component support several chart types. |
data_provider |
Sets the Data Provider. Required attribute. |
color |
Sets the color of the series. When the color isn't set - the series is drawn in Black. |
and the following subnodes:
Subnodes |
Description |
<name> |
This subnode contains the name of the series. This name is used legend. It is required parameter. |
Series Types and Required Fields
AnyChart Stock Component supports several series types and each type requires certain named fields to be declared in the data set. In terms of XML this means the following: if you declare, for example, the series of RangeArea type - the data provider should contain fields with high and low fields. See XML below for the clarification:
01 |
<?xml version="1.0" encoding="UTF-8"?> |
02 |
< stock xmlns = "http://anychart.com/products/stock/schemas/1.9.0/schema.xsd" > |
23 |
< name > <![CDATA[ High/Low Temp. (C) ]]> </ name > |
06 | sourceUrl: "./sample-data/weather_data.csv" |
38 | name: "High/Low Temp. (C)" |
The table below shows the list of supported series types and required fields.
Series Type |
Required fields |
Line |
"value" or "close" |
Spline |
"value" or "close" |
SplineArea |
"value" or "close" |
Bar |
"value" or "close" |
Area |
"value" or "close" |
RangeArea |
"high", "low" |
RangeBar |
"high", "low" |
RangeSplineArea |
"high", "low" |
StepLine |
"value" or "close" |
StepLineArea |
"value" or "close" |
Candlestick |
"open", "high", "low", "close" |
OHLC |
"open", "high", "low", "close" |
Marker |
"value" or "close" |
Stick |
"value" or "close" |
Configuration
Each series type has a lot of configuration options, some of these options are common for all types and some are unique, to learn more about possible settings please see: