Class CandlestickRenderer

All Implemented Interfaces:
Serializable, Cloneable, EventListener, AnnotationChangeListener, LegendItemSource, XYItemRenderer, PublicCloneable

public class CandlestickRenderer extends AbstractXYItemRenderer implements XYItemRenderer, Cloneable, PublicCloneable, Serializable
A renderer that draws candlesticks on an XYPlot (requires a OHLCDataset). The example shown here is generated by the CandlestickChartDemo1.java program included in the JFreeChart demo collection:

CandlestickRendererSample.png

This renderer does not include code to calculate the crosshair point for the plot.

See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      For serialization.
      See Also:
    • WIDTHMETHOD_AVERAGE

      public static final int WIDTHMETHOD_AVERAGE
      The average width method.
      See Also:
    • WIDTHMETHOD_SMALLEST

      public static final int WIDTHMETHOD_SMALLEST
      The smallest width method.
      See Also:
    • WIDTHMETHOD_INTERVALDATA

      public static final int WIDTHMETHOD_INTERVALDATA
      The interval data method.
      See Also:
    • 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 Paint upPaint
      The paint used to fill the candle when the price moved up from open to close.
    • downPaint

      private transient 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 Paint volumePaint
      The paint used to fill the volume bars (if they are visible). Once initialised, this field should never be set to null.
    • 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 is false to avoid a change of behaviour for existing code.
  • Constructor Details

    • 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 Details