Class CandlestickRenderer
- java.lang.Object
-
- org.jfree.chart.renderer.AbstractRenderer
-
- org.jfree.chart.renderer.xy.AbstractXYItemRenderer
-
- org.jfree.chart.renderer.xy.CandlestickRenderer
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.util.EventListener
,AnnotationChangeListener
,LegendItemSource
,XYItemRenderer
,PublicCloneable
public class CandlestickRenderer extends AbstractXYItemRenderer implements XYItemRenderer, java.lang.Cloneable, PublicCloneable, java.io.Serializable
A renderer that draws candlesticks on anXYPlot
(requires aOHLCDataset
). The example shown here is generated by theCandlestickChartDemo1.java
program included in the JFreeChart demo collection:
This renderer does not include code to calculate the crosshair point for the plot.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private double
autoWidthFactor
The number (generally between 0.0 and 1.0) by which the available space automatically calculated for the candles will be multiplied to determine the actual width to use.private double
autoWidthGap
The minimum gap between one candle and the nextprivate int
autoWidthMethod
The method of automatically calculating the candle width.private double
candleWidth
The candle width.private java.awt.Paint
downPaint
The paint used to fill the candle when the price moved down from open to close.private boolean
drawVolume
A flag controlling whether or not volume bars are drawn on the chart.private double
maxCandleWidth
Temporary storage for the maximum candle width.private double
maxCandleWidthInMilliseconds
The maximum candlewidth in milliseconds.private double
maxVolume
Temporary storage for the maximum volume.private static long
serialVersionUID
For serialization.private java.awt.Paint
upPaint
The paint used to fill the candle when the price moved up from open to close.private boolean
useOutlinePaint
A flag that controls whether or not the renderer's outline paint is used to draw the outline of the candlestick.private java.awt.Paint
volumePaint
The paint used to fill the volume bars (if they are visible).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_ITEM_LABEL_INSETS, DEFAULT_OUTLINE_PAINT, DEFAULT_OUTLINE_STROKE, DEFAULT_PAINT, DEFAULT_SHAPE, DEFAULT_STROKE, DEFAULT_VALUE_LABEL_FONT, DEFAULT_VALUE_LABEL_PAINT, ZERO
-
-
Constructor Summary
Constructors Constructor Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
equals(java.lang.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.java.awt.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.java.awt.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.java.awt.Paint
getVolumePaint()
Returns the paint that is used to fill the volume bars if they are visible.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).private void
readObject(java.io.ObjectInputStream stream)
Provides serialization support.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 aRendererChangeEvent
to all registered listeners.void
setAutoWidthMethod(int autoWidthMethod)
Sets the method of automatically calculating the candle width and sends aRendererChangeEvent
to all registered listeners.void
setCandleWidth(double width)
Sets the candle width and sends aRendererChangeEvent
to all registered listeners.void
setDownPaint(java.awt.Paint paint)
Sets the paint used to fill candles when the price moves down from open to close and sends aRendererChangeEvent
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 aRendererChangeEvent
to all registered listeners.void
setMaxCandleWidthInMilliseconds(double millis)
Sets the maximum candle width (in milliseconds) and sends aRendererChangeEvent
to all registered listeners.void
setUpPaint(java.awt.Paint paint)
Sets the paint used to fill candles when the price moves up from open to close and sends aRendererChangeEvent
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 aRendererChangeEvent
to all registered listeners.void
setVolumePaint(java.awt.Paint paint)
Sets the paint used to fill the volume bars, and sends aRendererChangeEvent
to all registered listeners.private void
writeObject(java.io.ObjectOutputStream stream)
Provides serialization support.-
Methods inherited from class org.jfree.chart.renderer.xy.AbstractXYItemRenderer
addAnnotation, addAnnotation, addEntity, annotationChanged, beginElementGroup, calculateDomainMarkerTextAnchorPoint, drawAnnotations, drawDomainLine, drawDomainMarker, drawItemLabel, drawRangeLine, drawRangeMarker, fillDomainGridBand, fillRangeGridBand, findDomainBounds, findDomainBounds, findRangeBounds, getAnnotations, getDefaultItemLabelGenerator, getDefaultToolTipGenerator, getDrawingSupplier, getItemLabelGenerator, getLegendItem, getLegendItemLabelGenerator, getLegendItems, getLegendItemToolTipGenerator, getLegendItemURLGenerator, getPassCount, getPlot, getSeriesItemLabelGenerator, getSeriesToolTipGenerator, getToolTipGenerator, getURLGenerator, hashCode, lineTo, moveTo, removeAnnotation, removeAnnotations, setDefaultItemLabelGenerator, setDefaultToolTipGenerator, setLegendItemLabelGenerator, setLegendItemToolTipGenerator, setLegendItemURLGenerator, setPlot, setSeriesItemLabelGenerator, setSeriesToolTipGenerator, setURLGenerator, updateCrosshairValues
-
Methods inherited from class org.jfree.chart.renderer.AbstractRenderer
addChangeListener, beginElementGroup, calculateLabelAnchorPoint, clearSeriesPaints, clearSeriesStrokes, endElementGroup, fireChangeEvent, getAutoPopulateSeriesFillPaint, getAutoPopulateSeriesOutlinePaint, getAutoPopulateSeriesOutlineStroke, getAutoPopulateSeriesPaint, getAutoPopulateSeriesShape, getAutoPopulateSeriesStroke, getDataBoundsIncludesVisibleSeriesOnly, getDefaultCreateEntities, getDefaultEntityRadius, getDefaultFillPaint, getDefaultItemLabelFont, getDefaultItemLabelPaint, getDefaultItemLabelsVisible, getDefaultLegendShape, getDefaultLegendTextFont, getDefaultLegendTextPaint, getDefaultNegativeItemLabelPosition, getDefaultOutlinePaint, getDefaultOutlineStroke, getDefaultPaint, getDefaultPositiveItemLabelPosition, getDefaultSeriesVisible, getDefaultSeriesVisibleInLegend, getDefaultShape, getDefaultStroke, getItemCreateEntity, getItemFillPaint, getItemLabelAnchorOffset, getItemLabelFont, getItemLabelInsets, getItemLabelPaint, getItemOutlinePaint, getItemOutlineStroke, getItemPaint, getItemShape, getItemStroke, getItemVisible, getLegendShape, getLegendTextFont, getLegendTextPaint, getNegativeItemLabelPosition, getPositiveItemLabelPosition, getSeriesCreateEntities, getSeriesFillPaint, getSeriesItemLabelFont, getSeriesItemLabelPaint, getSeriesNegativeItemLabelPosition, getSeriesOutlinePaint, getSeriesOutlineStroke, getSeriesPaint, getSeriesPositiveItemLabelPosition, getSeriesShape, getSeriesStroke, getSeriesVisible, getSeriesVisibleInLegend, getTreatLegendShapeAsLine, hasListener, isComputeItemLabelContrastColor, isItemLabelVisible, isSeriesItemLabelsVisible, isSeriesVisible, isSeriesVisibleInLegend, lookupLegendShape, lookupLegendTextFont, lookupLegendTextPaint, lookupSeriesFillPaint, lookupSeriesOutlinePaint, lookupSeriesOutlineStroke, lookupSeriesPaint, lookupSeriesShape, lookupSeriesStroke, notifyListeners, removeChangeListener, setAutoPopulateSeriesFillPaint, setAutoPopulateSeriesOutlinePaint, setAutoPopulateSeriesOutlineStroke, setAutoPopulateSeriesPaint, setAutoPopulateSeriesShape, setAutoPopulateSeriesStroke, setComputeItemLabelContrastColor, setDataBoundsIncludesVisibleSeriesOnly, setDefaultCreateEntities, setDefaultCreateEntities, setDefaultEntityRadius, setDefaultFillPaint, setDefaultFillPaint, setDefaultItemLabelFont, setDefaultItemLabelFont, setDefaultItemLabelPaint, setDefaultItemLabelPaint, setDefaultItemLabelsVisible, setDefaultItemLabelsVisible, setDefaultLegendShape, setDefaultLegendTextFont, setDefaultLegendTextPaint, setDefaultNegativeItemLabelPosition, setDefaultNegativeItemLabelPosition, setDefaultOutlinePaint, setDefaultOutlinePaint, setDefaultOutlineStroke, setDefaultOutlineStroke, setDefaultPaint, setDefaultPaint, setDefaultPositiveItemLabelPosition, setDefaultPositiveItemLabelPosition, setDefaultSeriesVisible, setDefaultSeriesVisible, setDefaultSeriesVisibleInLegend, setDefaultSeriesVisibleInLegend, setDefaultShape, setDefaultShape, setDefaultStroke, setDefaultStroke, setItemLabelAnchorOffset, setItemLabelInsets, setLegendShape, setLegendTextFont, setLegendTextPaint, setSeriesCreateEntities, setSeriesCreateEntities, setSeriesFillPaint, setSeriesFillPaint, setSeriesItemLabelFont, setSeriesItemLabelFont, setSeriesItemLabelPaint, setSeriesItemLabelPaint, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesNegativeItemLabelPosition, setSeriesNegativeItemLabelPosition, setSeriesOutlinePaint, setSeriesOutlinePaint, setSeriesOutlineStroke, setSeriesOutlineStroke, setSeriesPaint, setSeriesPaint, setSeriesPositiveItemLabelPosition, setSeriesPositiveItemLabelPosition, setSeriesShape, setSeriesShape, setSeriesStroke, setSeriesStroke, setSeriesVisible, setSeriesVisible, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setTreatLegendShapeAsLine
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jfree.chart.LegendItemSource
getLegendItems
-
Methods inherited from interface org.jfree.chart.renderer.xy.XYItemRenderer
addAnnotation, addAnnotation, addChangeListener, drawAnnotations, drawDomainLine, drawDomainMarker, drawRangeLine, drawRangeMarker, fillDomainGridBand, fillRangeGridBand, findDomainBounds, getDefaultCreateEntities, getDefaultFillPaint, getDefaultItemLabelFont, getDefaultItemLabelGenerator, getDefaultItemLabelPaint, getDefaultItemLabelsVisible, getDefaultNegativeItemLabelPosition, getDefaultOutlinePaint, getDefaultOutlineStroke, getDefaultPaint, getDefaultPositiveItemLabelPosition, getDefaultSeriesVisible, getDefaultSeriesVisibleInLegend, getDefaultShape, getDefaultStroke, getDefaultToolTipGenerator, getItemCreateEntity, getItemFillPaint, getItemLabelFont, getItemLabelGenerator, getItemLabelPaint, getItemOutlinePaint, getItemOutlineStroke, getItemPaint, getItemShape, getItemStroke, getItemVisible, getLegendItem, getLegendItemLabelGenerator, getNegativeItemLabelPosition, getPassCount, getPlot, getPositiveItemLabelPosition, getSeriesCreateEntities, getSeriesFillPaint, getSeriesItemLabelFont, getSeriesItemLabelGenerator, getSeriesItemLabelPaint, getSeriesNegativeItemLabelPosition, getSeriesOutlinePaint, getSeriesOutlineStroke, getSeriesPaint, getSeriesPositiveItemLabelPosition, getSeriesShape, getSeriesStroke, getSeriesToolTipGenerator, getSeriesVisible, getSeriesVisibleInLegend, getToolTipGenerator, getURLGenerator, isItemLabelVisible, isSeriesItemLabelsVisible, isSeriesVisible, isSeriesVisibleInLegend, removeAnnotation, removeAnnotations, removeChangeListener, setDefaultCreateEntities, setDefaultCreateEntities, setDefaultFillPaint, setDefaultFillPaint, setDefaultItemLabelFont, setDefaultItemLabelGenerator, setDefaultItemLabelPaint, setDefaultItemLabelsVisible, setDefaultItemLabelsVisible, setDefaultNegativeItemLabelPosition, setDefaultNegativeItemLabelPosition, setDefaultOutlinePaint, setDefaultOutlinePaint, setDefaultOutlineStroke, setDefaultOutlineStroke, setDefaultPaint, setDefaultPaint, setDefaultPositiveItemLabelPosition, setDefaultPositiveItemLabelPosition, setDefaultSeriesVisible, setDefaultSeriesVisible, setDefaultSeriesVisibleInLegend, setDefaultSeriesVisibleInLegend, setDefaultShape, setDefaultShape, setDefaultStroke, setDefaultStroke, setDefaultToolTipGenerator, setLegendItemLabelGenerator, setPlot, setSeriesCreateEntities, setSeriesCreateEntities, setSeriesFillPaint, setSeriesFillPaint, setSeriesItemLabelFont, setSeriesItemLabelGenerator, setSeriesItemLabelPaint, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesNegativeItemLabelPosition, setSeriesNegativeItemLabelPosition, setSeriesOutlinePaint, setSeriesOutlinePaint, setSeriesOutlineStroke, setSeriesOutlineStroke, setSeriesPaint, setSeriesPaint, setSeriesPositiveItemLabelPosition, setSeriesPositiveItemLabelPosition, setSeriesShape, setSeriesShape, setSeriesStroke, setSeriesStroke, setSeriesToolTipGenerator, setSeriesVisible, setSeriesVisible, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setURLGenerator
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
For serialization.- See Also:
- Constant Field Values
-
WIDTHMETHOD_AVERAGE
public static final int WIDTHMETHOD_AVERAGE
The average width method.- See Also:
- Constant Field Values
-
WIDTHMETHOD_SMALLEST
public static final int WIDTHMETHOD_SMALLEST
The smallest width method.- See Also:
- Constant Field Values
-
WIDTHMETHOD_INTERVALDATA
public static final int WIDTHMETHOD_INTERVALDATA
The interval data method.- See Also:
- Constant Field Values
-
autoWidthMethod
private int autoWidthMethod
The method of automatically calculating the candle width.
-
autoWidthFactor
private double autoWidthFactor
The number (generally between 0.0 and 1.0) by which the available space automatically calculated for the candles will be multiplied to determine the actual width to use.
-
autoWidthGap
private double autoWidthGap
The minimum gap between one candle and the next
-
candleWidth
private double candleWidth
The candle width.
-
maxCandleWidthInMilliseconds
private double maxCandleWidthInMilliseconds
The maximum candlewidth in milliseconds.
-
maxCandleWidth
private double maxCandleWidth
Temporary storage for the maximum candle width.
-
upPaint
private transient java.awt.Paint upPaint
The paint used to fill the candle when the price moved up from open to close.
-
downPaint
private transient java.awt.Paint downPaint
The paint used to fill the candle when the price moved down from open to close.
-
drawVolume
private boolean drawVolume
A flag controlling whether or not volume bars are drawn on the chart.
-
volumePaint
private transient java.awt.Paint volumePaint
The paint used to fill the volume bars (if they are visible). Once initialised, this field should never be set tonull
.
-
maxVolume
private transient double maxVolume
Temporary storage for the maximum volume.
-
useOutlinePaint
private boolean useOutlinePaint
A flag that controls whether or not the renderer's outline paint is used to draw the outline of the candlestick. The default value isfalse
to avoid a change of behaviour for existing code.
-
-
Constructor Detail
-
CandlestickRenderer
public CandlestickRenderer()
Creates a new renderer for candlestick charts.
-
CandlestickRenderer
public CandlestickRenderer(double candleWidth)
Creates a new renderer for candlestick charts.Use -1 for the candle width if you prefer the width to be calculated automatically.
- Parameters:
candleWidth
- The candle width.
-
CandlestickRenderer
public CandlestickRenderer(double candleWidth, boolean drawVolume, XYToolTipGenerator toolTipGenerator)
Creates a new renderer for candlestick charts.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.
-
-
Method Detail
-
getCandleWidth
public double getCandleWidth()
Returns the width of each candle.- Returns:
- The candle width.
- See Also:
setCandleWidth(double)
-
setCandleWidth
public void setCandleWidth(double width)
Sets the candle width and sends aRendererChangeEvent
to all registered listeners.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:
setAutoWidthMethod(int)
,setAutoWidthGap(double)
,setAutoWidthFactor(double)
,setMaxCandleWidthInMilliseconds(double)
-
getMaxCandleWidthInMilliseconds
public double getMaxCandleWidthInMilliseconds()
Returns the maximum width (in milliseconds) of each candle.- Returns:
- The maximum candle width in milliseconds.
- See Also:
setMaxCandleWidthInMilliseconds(double)
-
setMaxCandleWidthInMilliseconds
public void setMaxCandleWidthInMilliseconds(double millis)
Sets the maximum candle width (in milliseconds) and sends aRendererChangeEvent
to all registered listeners.- Parameters:
millis
- The maximum width.- See Also:
getMaxCandleWidthInMilliseconds()
,setCandleWidth(double)
,setAutoWidthMethod(int)
,setAutoWidthGap(double)
,setAutoWidthFactor(double)
-
getAutoWidthMethod
public int getAutoWidthMethod()
Returns the method of automatically calculating the candle width.- Returns:
- The method of automatically calculating the candle width.
- See Also:
setAutoWidthMethod(int)
-
setAutoWidthMethod
public void setAutoWidthMethod(int autoWidthMethod)
Sets the method of automatically calculating the candle width and sends aRendererChangeEvent
to all registered listeners.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()
,setCandleWidth(double)
,setAutoWidthGap(double)
,setAutoWidthFactor(double)
,setMaxCandleWidthInMilliseconds(double)
-
getAutoWidthFactor
public 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.- Returns:
- The width factor (generally between 0.0 and 1.0).
- See Also:
setAutoWidthFactor(double)
-
setAutoWidthFactor
public 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.- Parameters:
autoWidthFactor
- The width factor (generally between 0.0 and 1.0).- See Also:
getAutoWidthFactor()
,setCandleWidth(double)
,setAutoWidthMethod(int)
,setAutoWidthGap(double)
,setMaxCandleWidthInMilliseconds(double)
-
getAutoWidthGap
public double getAutoWidthGap()
Returns the amount of space to leave on the left and right of each candle when automatically calculating widths.- Returns:
- The gap.
- See Also:
setAutoWidthGap(double)
-
setAutoWidthGap
public 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 aRendererChangeEvent
to all registered listeners.- Parameters:
autoWidthGap
- The gap.- See Also:
getAutoWidthGap()
,setCandleWidth(double)
,setAutoWidthMethod(int)
,setAutoWidthFactor(double)
,setMaxCandleWidthInMilliseconds(double)
-
getUpPaint
public java.awt.Paint getUpPaint()
Returns the paint used to fill candles when the price moves up from open to close.- Returns:
- The paint (possibly
null
). - See Also:
setUpPaint(Paint)
-
setUpPaint
public void setUpPaint(java.awt.Paint paint)
Sets the paint used to fill candles when the price moves up from open to close and sends aRendererChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
permitted).- See Also:
getUpPaint()
-
getDownPaint
public java.awt.Paint getDownPaint()
Returns the paint used to fill candles when the price moves down from open to close.- Returns:
- The paint (possibly
null
). - See Also:
setDownPaint(Paint)
-
setDownPaint
public void setDownPaint(java.awt.Paint paint)
Sets the paint used to fill candles when the price moves down from open to close and sends aRendererChangeEvent
to all registered listeners.- Parameters:
paint
- The paint (null
permitted).
-
getDrawVolume
public boolean getDrawVolume()
Returns a flag indicating whether or not volume bars are drawn on the chart.- Returns:
- A boolean.
- See Also:
setDrawVolume(boolean)
-
setDrawVolume
public void setDrawVolume(boolean flag)
Sets a flag that controls whether or not volume bars are drawn in the background and sends aRendererChangeEvent
to all registered listeners.- Parameters:
flag
- the flag.- See Also:
getDrawVolume()
-
getVolumePaint
public java.awt.Paint getVolumePaint()
Returns the paint that is used to fill the volume bars if they are visible.- Returns:
- The paint (never
null
). - See Also:
setVolumePaint(Paint)
-
setVolumePaint
public void setVolumePaint(java.awt.Paint paint)
Sets the paint used to fill the volume bars, and sends aRendererChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
not permitted).- See Also:
getVolumePaint()
,getDrawVolume()
-
getUseOutlinePaint
public boolean getUseOutlinePaint()
Returns the flag that controls whether or not the renderer's outline paint is used to draw the candlestick outline. The default value isfalse
.- Returns:
- A boolean.
- See Also:
setUseOutlinePaint(boolean)
-
setUseOutlinePaint
public 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 aRendererChangeEvent
to all registered listeners.- Parameters:
use
- the new flag value.- See Also:
getUseOutlinePaint()
-
findRangeBounds
public Range findRangeBounds(XYDataset dataset)
Returns the range of values the renderer requires to display all the items from the specified dataset.- Specified by:
findRangeBounds
in interfaceXYItemRenderer
- Overrides:
findRangeBounds
in classAbstractXYItemRenderer
- Parameters:
dataset
- the dataset (null
permitted).- Returns:
- The range (
null
if the dataset isnull
or empty). - See Also:
AbstractXYItemRenderer.findDomainBounds(XYDataset)
-
initialise
public 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). This method will be called before the first item is rendered, giving the renderer an opportunity to initialise any state information it wants to maintain. The renderer can do nothing if it chooses.- Specified by:
initialise
in interfaceXYItemRenderer
- Overrides:
initialise
in classAbstractXYItemRenderer
- 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.
-
drawItem
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)
Draws the visual representation of a single data item.- Specified by:
drawItem
in interfaceXYItemRenderer
- 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.
-
equals
public boolean equals(java.lang.Object obj)
Tests this renderer for equality with another object.- Overrides:
equals
in classAbstractXYItemRenderer
- Parameters:
obj
- the object (null
permitted).- Returns:
true
orfalse
.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
Returns a clone of the renderer.- Specified by:
clone
in interfacePublicCloneable
- Overrides:
clone
in classAbstractXYItemRenderer
- Returns:
- A clone.
- Throws:
java.lang.CloneNotSupportedException
- if the renderer cannot be cloned.
-
writeObject
private void writeObject(java.io.ObjectOutputStream stream) throws java.io.IOException
Provides serialization support.- Parameters:
stream
- the output stream.- Throws:
java.io.IOException
- if there is an I/O error.
-
readObject
private void readObject(java.io.ObjectInputStream stream) throws java.io.IOException, java.lang.ClassNotFoundException
Provides serialization support.- Parameters:
stream
- the input stream.- Throws:
java.io.IOException
- if there is an I/O error.java.lang.ClassNotFoundException
- if there is a classpath problem.
-
-