Package org.faceless.graph2
Class CandleSeries
- java.lang.Object
-
- org.faceless.graph2.Series
-
- org.faceless.graph2.CandleSeries
-
public class CandleSeries extends Series
A Candle Series is typically used for plotting stock prices. Each date has an opening and closing price, as well as a daily high and low, which are plotted as "candles" on the graph. A good description of Candle graphs is at http://www.trade10.com/candlesticks.html.
-
-
Constructor Summary
Constructors Constructor Description CandleSeries(String name)
Create a new CandleSeries
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
set(Date date, double open, double close, double min, double max)
Add a candle to the series.void
setBarWidth(double width)
Set the width of each candle.void
setStyle(Date date, Style style)
Set the style for a particular candle.-
Methods inherited from class org.faceless.graph2.Series
addBox, addLine, addMarker, getName, outputToSeries, outputToSeriesFunction, setStyle, toString
-
-
-
-
Constructor Detail
-
CandleSeries
public CandleSeries(String name)
Create a new CandleSeries- Parameters:
name
- the name of the series
-
-
Method Detail
-
set
public void set(Date date, double open, double close, double min, double max)
Add a candle to the series. Currently candles can only be plotted daily, so dates passed in to this method should have their time component set to 00:00:00- Parameters:
date
- the date of the pricing informationopen
- the opening price for that dayclose
- the closing price for that daymin
- the minimum price for that daymax
- the maximum price for that day- Throws:
IllegalArgumentException
- if min is not the lowest of the four values, or max is not the highest
-
setStyle
public void setStyle(Date date, Style style)
Set the style for a particular candle. If not set, the candle is the same style as all the others.- Parameters:
date
- the date of the pricing informationstyle
- the style to paint that candle in
-
setBarWidth
public void setBarWidth(double width)
Set the width of each candle. The default is 0.75, and valid values are 0 < val <= 1- Parameters:
width
- the width of the box of each candle - must be 0 < val <=1
-
-