An open-close candle stock graph is a graph that is specifically designed for showing the opening and closing prices of a stock on a particular day. Each stock marker displays two separate values.
The constant for this graph type is STOCK_CANDLE
.
You use stock graphs to show more than one stock price for a stock.
The following figure shows the data structure of a STOCK_CANDLE
stock graph.
The data structure for open-close candle stock graphs is as follows:
A group is a two-column set or, if data columns are shown as series, then as a two-row set of data. Each group is represented by a single stock marker. If you show data for more than one group, then the opening and closing values should vary faster than the Time values. That is, the order of the columns (or rows) should be Monday Open, Monday Close, Tuesday Open, Tuesday Close, and so on. A group is labeled by an O1 tick label, such as Fri.
Candle stock graphs display only one series of data. If you have more than one series of data, then only the first series is displayed. For this reason, no legend appears in a candle stock graph. You should show the series label in the title of the graph.
Each group in this kind of stock graph has two measure values:
The first value is the opening price. The opening price defines the top or the bottom of the candle (rectangle).
The second value is the closing price. The closing price also defines the top or the bottom of the candle.
The lesser of the two values defines the bottom of the candle. The greater value defines the top. If the closing value is greater than the opening value, then the candle is green. If the opening value is higher than the closing value, then the candle is red.
Data for this kind of stock graph has the following guidelines:
All graphs show numeric data only.
The open-close stock graph must have at least two columns of data (or rows of data, if columns are series), in this order:
Open
Close
If the data has fewer than two columns (or rows) of data, then the Graph bean displays a message about insufficient data, instead of displaying a graph.
To display stock data for more than one day, the data must be in multiples
of two, such as two colums (or rows) for Monday, then two for Tuesday, and
so on. If the last group does not have two columns (or rows), then the graph
does not display that group. The graph notifies any registered AlertListeners
of this problem by sending an AlertEvent
, with DATA_PARTIAL_GROUP
as its ID.
Open-close stock graphs can have only one series of data. If you have more than one series of data, then only the first series appears in the graph. This graph type does not display a legend, so you should display the name of the stock in a title.
Time axis data must be regular, complete, and in ascending order. If it is not, then the graph displays a regular ordinal axis rather than a time axis. The graph recognizes time data that skips days when stocks are not traded.
The following graph shows the stock data for one stock for two different days.
The following table shows the grid of data that the stock graph displays. This
example assumes that Graph.isDataRowShownAsASeries
returns true
.
Mon Open | Mon Close | Tues Open | Tues Close |
---|---|---|---|
30.25 | 40.13 | 40.75 | 31.75 |
Stock Graphs
Handling Problems
in Graph Data
Specifying Data for a Graph
Example: Setting Data from
a File on a High-Low-Close Stock Graph