|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jfree.chart.renderer.AbstractRenderer
org.jfree.chart.renderer.xy.AbstractXYItemRenderer
org.jfree.chart.renderer.xy.CandlestickRenderer
A renderer that draws candlesticks on an XYPlot
(requires a OHLCDataset
).
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. |
Fields inherited from class org.jfree.chart.renderer.AbstractRenderer |
DEFAULT_OUTLINE_PAINT, DEFAULT_OUTLINE_STROKE, DEFAULT_PAINT, DEFAULT_SHAPE, DEFAULT_STROKE, DEFAULT_VALUE_LABEL_FONT, DEFAULT_VALUE_LABEL_PAINT, ZERO |
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 | |
java.lang.Object |
clone()
Returns a clone of the renderer. |
void |
drawItem(java.awt.Graphics2D g2,
XYItemRendererState state,
java.awt.geom.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(java.lang.Object obj)
Tests this renderer for equality with another object. |
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. |
java.awt.Paint |
getDownPaint()
Returns the paint used to fill candles when the price moves down from open to close. |
double |
getMaxCandleWidthInMilliseconds()
Returns the maximum width (in milliseconds) of each candle. |
java.awt.Paint |
getUpPaint()
Returns the paint used to fill candles when the price moves up from open to close. |
XYItemRendererState |
initialise(java.awt.Graphics2D g2,
java.awt.geom.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. |
void |
setAutoWidthMethod(int autoWidthMethod)
Sets the method of automatically calculating the candle width. |
void |
setCandleWidth(double width)
Sets the candle width. |
void |
setDownPaint(java.awt.Paint paint)
Sets the paint used to fill candles when the price moves down from open to close. |
void |
setDrawVolume(boolean flag)
Sets a flag that controls whether or not volume bars are drawn in the background. |
void |
setMaxCandleWidthInMilliseconds(double millis)
Sets the maximum candle width (in milliseconds). |
void |
setUpPaint(java.awt.Paint paint)
Sets the paint used to fill candles when the price moves up from open to close. |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.jfree.chart.LegendItemSource |
getLegendItems |
Field Detail |
public static final int WIDTHMETHOD_AVERAGE
public static final int WIDTHMETHOD_SMALLEST
public static final int WIDTHMETHOD_INTERVALDATA
Constructor Detail |
public CandlestickRenderer()
public CandlestickRenderer(double candleWidth)
Use -1 for the candle width if you prefer the width to be calculated automatically.
candleWidth
- The candle width.public CandlestickRenderer(double candleWidth, boolean drawVolume, XYToolTipGenerator toolTipGenerator)
Use -1 for the candle width if you prefer the width to be calculated automatically.
candleWidth
- the candle width.drawVolume
- a flag indicating whether or not volume bars should be drawn.toolTipGenerator
- the tool tip generator. null
is none.Method Detail |
public double getCandleWidth()
setCandleWidth(double)
public void setCandleWidth(double width)
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.
width
- The width.setAutoWidthMethod(int)
,
setAutoWidthGap(double)
,
setAutoWidthFactor(double)
,
setMaxCandleWidthInMilliseconds(double)
public double getMaxCandleWidthInMilliseconds()
public void setMaxCandleWidthInMilliseconds(double millis)
millis
- The maximum width.setCandleWidth(double)
,
setAutoWidthMethod(int)
,
setAutoWidthGap(double)
,
setAutoWidthFactor(double)
public int getAutoWidthMethod()
public void setAutoWidthMethod(int autoWidthMethod)
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.
autoWidthMethod
- The method of automatically calculating the candle width.WIDTHMETHOD_AVERAGE
,
WIDTHMETHOD_SMALLEST
,
WIDTHMETHOD_INTERVALDATA
,
setCandleWidth(double)
,
setAutoWidthGap(double)
,
setAutoWidthFactor(double)
,
setMaxCandleWidthInMilliseconds(double)
public double getAutoWidthFactor()
public void setAutoWidthFactor(double autoWidthFactor)
autoWidthFactor
- The width factor (generally between 0.0 and 1.0).setCandleWidth(double)
,
setAutoWidthMethod(int)
,
setAutoWidthGap(double)
,
setMaxCandleWidthInMilliseconds(double)
public double getAutoWidthGap()
public void setAutoWidthGap(double autoWidthGap)
autoWidthGap
- The gap.setCandleWidth(double)
,
setAutoWidthMethod(int)
,
setAutoWidthFactor(double)
,
setMaxCandleWidthInMilliseconds(double)
public java.awt.Paint getUpPaint()
public void setUpPaint(java.awt.Paint paint)
Registered property change listeners are notified that the "CandleStickRenderer.upPaint" property has changed.
paint
- The paint.public java.awt.Paint getDownPaint()
public void setDownPaint(java.awt.Paint paint)
Registered property change listeners are notified that the "CandleStickRenderer.downPaint" property has changed.
paint
- The paint.public boolean drawVolume()
true
if volume bars are drawn on the chart.public void setDrawVolume(boolean flag)
flag
- The flag.public XYItemRendererState initialise(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, XYPlot plot, XYDataset dataset, PlotRenderingInfo info)
initialise
in interface XYItemRenderer
initialise
in class AbstractXYItemRenderer
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.
public void drawItem(java.awt.Graphics2D g2, XYItemRendererState state, java.awt.geom.Rectangle2D dataArea, PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, CrosshairState crosshairState, int pass)
drawItem
in interface XYItemRenderer
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.public boolean equals(java.lang.Object obj)
equals
in class AbstractXYItemRenderer
obj
- the object.
true
or false
.public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class AbstractXYItemRenderer
java.lang.CloneNotSupportedException
- if the renderer cannot be cloned.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |