ChartDirector 5.1 (PHP Edition)

XYChart.addCandleStickLayer


Usage

addCandleStickLayer(highData, lowData, openData, closeData [, riseColor [, fallColor [, edgeColor ]]])

Description

Adds a candlestick layer to the XYChart, and specify the data sets to use for drawing the layer.

By default, the candlestick symbol will be drawn using the colors specified in the riseColor, fallColor and edgeColor argument. The riseColor and fallColor are used to fill the candle depending on whether the opening value or closing value is larger. The edgeColor is used to the center line and the border of the candle.

Internally, ChartDirector maps the colors of different parts of the candlestick symbol to data set colors as shown in the following table. You may control the colors of the candlestick symbol in more details by setting the data set colors directly. The data set objects can be obtained using Layer.getDataSet, and the colors can be changed using DataSet.setDataColor.

Candlestick Symbol ColorData Set Color
Fill color for "up" candlesticksData Color for the first data set (index = 0).
Fill color for "down" candlesticksData Color for the second data set (index = 1).
Border colorEdge Color for the first data set (index = 0).
Center line colorEdge Color for the second data set (index = 1).

Arguments

ArgumentDefaultDescription
highData(Mandatory)An array of numbers representing the high values.
lowData(Mandatory)An array of numbers representing the low values.
openData(Mandatory)An array of numbers representing the opening values.
closeData(Mandatory)An array of numbers representing the closing values.
riseColorFFFFFFThe color used to fill the candle if the closing value is higher than the opening value.
fallColor000000The color used to fill the candle if the opening value is higher than the closing value.
edgeColorLineColorThe color used to draw the center line and the border of the candle.

Return Value

A CandleStickLayer object representing the candlestick layer created.