CandleStick Series
Overview
The Japanese candlestick chart is a style of bar-chart used primarily to describe price movements of an equity over time. It is a combination of a line-chart and a bar-chart, in that each bar represents the range of price movement over a given time interval. It is most often used in technical analysis of equity and currency price patterns.
Candlesticks are usually composed of the body (black or white), an upper and a lower shadow (wick). The wick illustrates the highest and lowest traded prices of a stock, and the body the opening and closing trades. If the stock went up, the body is white, with the opening price at the bottom of the body and the closing price at the top. If the stock went down, the body is black, with the opening price at the top and the closing price at the bottom. A candlestick need not have either a body or a wick.
Adding Candlestick Series
Data-Provider
Before you can add Candlestick series to the chart you need to prepare Data Provider. You need four fields to create Candlestick chart: open, high, low and close. So the Data Provider should contain all these four fields.
Sample XML for Candlestick Data Provider:
As you can see four fields are defined open, high, low and close. Now you can declare series that will use this Data Provider.
Series Declaration
XML syntax to declare series with Data Provider shown above:
Let's put this together and create the very basic Candlestick sample:
Live Sample: Candlestick Series
To learn more about common series settings see Common Series Settings tutorial.
Configuring visualization
All visual and specific settings for Candlestick series are set in <candlestick_series> in <series> node.
The width of candlestick bar is set using width attribute: <candlestick_series width="0.5">, which accepts values from 0 to 1.
Also, you can tune different candlestick visualization depending on rise or fall of the price. These settings are done in <rising>, and <falling> nodes.
Sample XML with width and different visualization for rise and fall:
Live Sample below shows two charts with different Candlestick series, each with own specific settings:
Live Sample: Candlestick Series Visual Settings
To learn more about all available settings about visual settings see respective nodes in XML Reference.
Legend Element
For each series you can define its element in legend. This element contains the settings for the formatting string of the text in legend that represents the series. Configuration of such elements is described in Legend: Series Labels article.
Tooltips
You can either use global tooltip settings or create personal tooltips for each series. See detailed description in Tooltips tutorial.
Choosing Field for Comparison Mode
When you use Candlestick series in comparison mode (when Value axis is set to "Changes" or "PercentChanges") - you need to define comparison field.
XML for comparison mode field selection:
As you can see comparison field is set in compare_field_type attribute, which can be:
Open, High, Low and Close. By default it is Close.
Live sample below shows Candlestick and Line series on one chart in
Comparison mode with comparison field set to Open:
Live Sample: Candlestick Series In Comparision Mode
Defaults Section
There is a special section to set default values in AnyChart Stock component XML:
<series_settings_defaults>, where you can define marker and value highlighter settings for all series of the given type
in one place, instead of setting them for each series individually.
For example, to configure all series of Candlestick type just set:
14 | color: "DarkColor(%Color)" , |
33 | color: "LightColor(%Color)" , |
Live sample below has two series of Candlestick type. All common settings defined in <series_settings_defaults/> node :
Live Sample: Candlestick Series - Using Defaults Sections