org.jfree.chart.renderer.xy
public class CandlestickRenderer extends AbstractXYItemRenderer implements XYItemRenderer, Cloneable, PublicCloneable, Serializable
This renderer does not include code to calculate the crosshair point for the plot.
Field Summary | |
---|---|
static int | WIDTHMETHOD_AVERAGE The average width method. |
static int | WIDTHMETHOD_INTERVALDATA The interval data method. |
static int | WIDTHMETHOD_SMALLEST The smallest width method. |
Constructor Summary | |
---|---|
CandlestickRenderer()
Creates a new renderer for candlestick charts. | |
CandlestickRenderer(double candleWidth)
Creates a new renderer for candlestick charts.
| |
CandlestickRenderer(double candleWidth, boolean drawVolume, XYToolTipGenerator toolTipGenerator)
Creates a new renderer for candlestick charts.
|
Method Summary | |
---|---|
Object | clone()
Returns a clone of the renderer.
|
void | drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D dataArea, PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, CrosshairState crosshairState, int pass)
Draws the visual representation of a single data item.
|
boolean | drawVolume()
Returns a flag indicating whether or not volume bars are drawn on the
chart.
|
boolean | equals(Object obj)
Tests this renderer for equality with another object.
|
Range | findRangeBounds(XYDataset dataset)
Returns the range of values the renderer requires to display all the
items from the specified dataset.
|
double | getAutoWidthFactor()
Returns the factor by which the available space automatically
calculated for the candles will be multiplied to determine the actual
width to use.
|
double | getAutoWidthGap()
Returns the amount of space to leave on the left and right of each
candle when automatically calculating widths.
|
int | getAutoWidthMethod()
Returns the method of automatically calculating the candle width.
|
double | getCandleWidth()
Returns the width of each candle.
|
Paint | getDownPaint()
Returns the paint used to fill candles when the price moves down from
open to close.
|
boolean | getDrawVolume()
Returns a flag indicating whether or not volume bars are drawn on the
chart.
|
double | getMaxCandleWidthInMilliseconds()
Returns the maximum width (in milliseconds) of each candle.
|
Paint | getUpPaint()
Returns the paint used to fill candles when the price moves up from open
to close.
|
boolean | getUseOutlinePaint()
Returns the flag that controls whether or not the renderer's outline
paint is used to draw the candlestick outline. |
Paint | getVolumePaint()
Returns the paint that is used to fill the volume bars if they are
visible.
|
XYItemRendererState | initialise(Graphics2D g2, Rectangle2D dataArea, XYPlot plot, XYDataset dataset, PlotRenderingInfo info)
Initialises the renderer then returns the number of 'passes' through the
data that the renderer will require (usually just one). |
void | setAutoWidthFactor(double autoWidthFactor)
Sets the factor by which the available space automatically calculated
for the candles will be multiplied to determine the actual width to use.
|
void | setAutoWidthGap(double autoWidthGap)
Sets the amount of space to leave on the left and right of each candle
when automatically calculating widths and sends a
RendererChangeEvent to all registered listeners.
|
void | setAutoWidthMethod(int autoWidthMethod)
Sets the method of automatically calculating the candle width and
sends a RendererChangeEvent to all registered listeners.
|
void | setCandleWidth(double width)
Sets the candle width and sends a RendererChangeEvent to all
registered listeners.
|
void | setDownPaint(Paint paint)
Sets the paint used to fill candles when the price moves down from open
to close and sends a RendererChangeEvent to all registered
listeners.
|
void | setDrawVolume(boolean flag)
Sets a flag that controls whether or not volume bars are drawn in the
background and sends a RendererChangeEvent to all registered
listeners.
|
void | setMaxCandleWidthInMilliseconds(double millis)
Sets the maximum candle width (in milliseconds) and sends a
RendererChangeEvent to all registered listeners.
|
void | setUpPaint(Paint paint)
Sets the paint used to fill candles when the price moves up from open
to close and sends a RendererChangeEvent to all registered
listeners.
|
void | setUseOutlinePaint(boolean use)
Sets the flag that controls whether or not the renderer's outline
paint is used to draw the candlestick outline, and sends a
RendererChangeEvent to all registered listeners.
|
void | setVolumePaint(Paint paint)
Sets the paint used to fill the volume bars, and sends a
RendererChangeEvent to all registered listeners.
|
Use -1 for the candle width if you prefer the width to be calculated automatically.
Parameters: candleWidth The candle width.
Use -1 for the candle width if you prefer the width to be calculated automatically.
Parameters: candleWidth the candle width. drawVolume a flag indicating whether or not volume bars should
be drawn. toolTipGenerator the tool tip generator. null
is
none.
Returns: A clone.
Throws: CloneNotSupportedException if the renderer cannot be cloned.
Parameters: g2 the graphics device. state the renderer state. dataArea the area within which the plot is being drawn. info collects info about the drawing. plot the plot (can be used to obtain standard color
information etc). domainAxis the domain axis. rangeAxis the range axis. dataset the dataset. series the series index (zero-based). item the item index (zero-based). crosshairState crosshair information for the plot
(null
permitted). pass the pass index.
Deprecated: As of 1.0.5, you should use the getDrawVolume method.
Returns a flag indicating whether or not volume bars are drawn on the chart.Returns: true
if volume bars are drawn on the chart.
Parameters: obj the object (null
permitted).
Returns: true
or false
.
Parameters: dataset the dataset (null
permitted).
Returns: The range (null
if the dataset is null
or empty).
Returns: The width factor (generally between 0.0 and 1.0).
See Also: CandlestickRenderer
Returns: The gap.
See Also: CandlestickRenderer
Returns: The method of automatically calculating the candle width.
See Also: CandlestickRenderer
Returns: The candle width.
See Also: CandlestickRenderer
Returns: The paint (possibly null
).
See Also: setDownPaint
Returns: A boolean.
Since: 1.0.5
See Also: CandlestickRenderer
Returns: The maximum candle width in milliseconds.
See Also: CandlestickRenderer
Returns: The paint (possibly null
).
See Also: setUpPaint
false
.
Returns: A boolean.
Since: 1.0.5
See Also: CandlestickRenderer
Returns: The paint (never null
).
Since: 1.0.7
Parameters: g2 the graphics device. dataArea the area inside the axes. plot the plot. dataset the data. info an optional info collection object to return data back to the caller.
Returns: The number of passes the renderer requires.
Parameters: autoWidthFactor The width factor (generally between 0.0 and 1.0).
See Also: getAutoWidthFactor CandlestickRenderer CandlestickRenderer CandlestickRenderer CandlestickRenderer
Parameters: autoWidthGap The gap.
See Also: getAutoWidthGap CandlestickRenderer CandlestickRenderer CandlestickRenderer CandlestickRenderer
WIDTHMETHOD_AVERAGE
: Divides the entire display (ignoring
scale factor) by the number of items, and uses this as the available
width.
WIDTHMETHOD_SMALLEST
: Checks the interval between each
item, and uses the smallest as the available width.
WIDTHMETHOD_INTERVALDATA
: Assumes that the dataset supports
the IntervalXYDataset interface, and uses the startXValue - endXValue as
the available width.
Parameters: autoWidthMethod The method of automatically calculating the candle width.
See Also: WIDTHMETHOD_AVERAGE WIDTHMETHOD_SMALLEST WIDTHMETHOD_INTERVALDATA getAutoWidthMethod CandlestickRenderer CandlestickRenderer CandlestickRenderer CandlestickRenderer
If you set the width to a negative value, the renderer will calculate the candle width automatically based on the space available on the chart.
Parameters: width The width.
See Also: CandlestickRenderer CandlestickRenderer CandlestickRenderer CandlestickRenderer
Parameters: paint The paint (null
permitted).
Parameters: flag the flag.
See Also: getDrawVolume
Parameters: millis The maximum width.
See Also: getMaxCandleWidthInMilliseconds CandlestickRenderer CandlestickRenderer CandlestickRenderer CandlestickRenderer
Parameters: paint the paint (null
permitted).
See Also: getUpPaint
Parameters: use the new flag value.
Since: 1.0.5
See Also: getUseOutlinePaint
Parameters: paint the paint (null
not permitted).
Since: 1.0.7
See Also: getVolumePaint