com.ijchart.xychart.render.xy
Class StockRender

java.lang.Object
  extended by com.ijchart.xychart.render.AbstractRender
      extended by com.ijchart.xychart.render.AbstractWithAxisRender
          extended by com.ijchart.xychart.render.xy.AbstractXYRender
              extended by com.ijchart.xychart.render.xy.StockRender
All Implemented Interfaces:
IDatasetChangeListener, IRender, IRenderWithAxis, java.io.Serializable, java.lang.Cloneable, java.util.EventListener

public class StockRender
extends AbstractXYRender
implements java.lang.Cloneable, java.io.Serializable

Title: IJChart

Description: a chart library for the Java(tm) platform.

Draw stock shapes.

Copyright: Copyright (c) 2013

Company:

Version:
1.0
Author:
zhang feng min,shanghai china. Contract me by email.
See Also:
Serialized Form

Field Summary
static double DEFAULT_AUTO_WIDTH_FACTOR
           The default factor for calculate shape width.
static java.awt.Paint DEFAULT_DOWN_PAINT
           The default paint used to fill the shape when the price moved down from open to close.
static double DEFAULT_MAX_SHAPE_WIDTH_IN_PERCENT
           The default maximum width of the graphic to percentage of axis length.
static java.awt.Paint DEFAULT_UP_PAINT
           The default paint used to fill the shape when the price moved up from open to close.
static java.awt.Paint DEFAULT_VOLUME_PAINT
           The default paint used to fill the volume bars.
 
Fields inherited from class com.ijchart.xychart.render.AbstractRender
borderPaints, borderStrokes, DEFAULT_AUTO_SELECT_BORDER_PAINT, DEFAULT_AUTO_SELECT_BORDER_STROKE, DEFAULT_AUTO_SELECT_FILL_PAINT, DEFAULT_BACKGROUND_IMAGE_ALIGNMENT, DEFAULT_BACKGROUND_PAINT, DEFAULT_BASE_BORDER_PAINT, DEFAULT_BASE_BORDER_STROKE, DEFAULT_BASE_ITEM_FILL, DEFAULT_BASE_ITEM_FILL_PAINT, DEFAULT_BASE_ITEM_FILL_PAINT_TRANSFORMER, DEFAULT_BASE_ITEM_LABEL_FONT, DEFAULT_BASE_ITEM_LABEL_HORIZONTAL_ALIGNMENT, DEFAULT_BASE_ITEM_LABEL_PAINT, DEFAULT_BASE_ITEM_LABEL_VERTICAL_ALIGNMENT, DEFAULT_BASE_ITEM_LABEL_VISIBLE, DEFAULT_BORDER_PAINT, DEFAULT_BORDER_STROKE, DEFAULT_DRAW_BORDER, DEFAULT_DRAWINT_SUPPLIER, DEFAULT_GENERATOR_TOOLTIP, DEFAULT_GENERATOR_URL, DEFAULT_LABEL_GENERATOR, DEFAULT_RENDER_AREA_BORDER_VISIBLE, DEFAULT_TOOLTIP_GENERATOR, fillPaints
 
Constructor Summary
StockRender(SingleRowDataset dataset)
           The constructor.
StockRender(SingleRowDataset dataset, double shapeWidth)
           The constructor.
StockRender(SingleRowDataset dataset, double shapeWidth, boolean drawVolume)
           The constructor.
 
Method Summary
 java.lang.Object clone()
           Creates and returns a copy of this object.
protected  IChartShape createItemShapeOnly(java.awt.geom.Rectangle2D rect, java.lang.String text, java.lang.Object appendParam)
           Create a shape with no attribute specified.
 void drawAllItems(AbstractValueAxis xAxis, RectangleEdge xAxisEdge, AbstractValueAxis yAxis, RectangleEdge yAxisEdge, java.awt.geom.Rectangle2D dataArea, ChartOrientation orientation, RenderShapeCollection renderShapes, float alpha)
           Draws all data items.
 boolean equals(java.lang.Object obj)
           Indicates if some other object is "equal to" this one.
 double getAutoWidthFactor()
           Returns the factor for calculate shape width.
 double getAutoWidthGap()
           Returns the minimum gap between one shape and the next.
 java.awt.Paint getDownPaint()
           Returns the paint used to fill the shape when the price moved down from open to close.
 LegendType getLegendType()
           Return the legend type.
 double getMaxShapeWidthInPercent()
           Returns the default maximum width of the graphic to percentage of axis length.
 double getShapeWidth()
           Returns the shape width.
 java.awt.Paint getUpPaint()
           Returns the paint used to fill the shape when the price moved up from open to close.
 java.awt.Paint getVolumePaint()
           Returns the paint used to fill the volume bars (if they are visible).
 int hashCode()
           Returns a hash code value for the object.
 boolean isDrawVolume()
           Returns whether or not volume bars are drawn on the chart.
 void setAutoWidthFactor(double factor)
           Sets the factor for calculate shape width.
 void setAutoWidthGap(double autoWidthGap)
           Sets the minimum gap between one shape and the next and sends a RenderChangeEvent to all registered listeners.
 void setDownPaint(java.awt.Paint paint)
           Sets the paint used to fill the shape when the price moved down from open to close,and sends a RenderChangeEvent to all registered listeners.
 void setDrawVolume(boolean flag)
           Sets the flag controlling whether or not volume bars are drawn on the chart and sends a RenderChangeEvent to all registered listeners.
 void setMaxShapeWidthInPercent(double percent)
           The default maximum width of the graphic to percentage of axis length,and sends a RenderChangeEvent to all registered listeners.
 void setShapeWidth(double width)
           Sets the shape width and sends a RenderChangeEvent to all registered listeners.
 void setUpPaint(java.awt.Paint paint)
           Sets the paint used to fill the shape when the price moved up from open to close,and sends a RenderChangeEvent to all registered listeners.
 void setVolumePaint(java.awt.Paint paint)
           Sets the paint used to fill the volume bars (if they are visible) and sends a RenderChangeEvent to all registered listeners.
 java.lang.String toString()
           Returns a string representation of the object.
 
Methods inherited from class com.ijchart.xychart.render.xy.AbstractXYRender
addAnnotation, drawAllAnnotation, getAllAnnotations, removeAllAnnotation
 
Methods inherited from class com.ijchart.xychart.render.AbstractWithAxisRender
createItemShape, createValueMarkerShape, drawIntervalValueMarker, drawValueMarker, getValueAxisOffsetType
 
Methods inherited from class com.ijchart.xychart.render.AbstractRender
add3DShapes, addChangeListener, calculateLegendItemShapes, datasetChanged, drawBackground, drawBackgroundImage, drawDrawAreaBorder, fireRenderChanged, getBackgroundImage, getBackgroundImageAlignment, getBackgroundImageAlpha, getBackgroundPaint, getBaseItemBorderPaint, getBaseItemBorderStroke, getBaseItemFillPaint, getBaseItemFillPaintTransformer, getBaseItemLabelDirection, getBaseItemLabelFont, getBaseItemLabelHorizontalAlignment, getBaseItemLabelPaint, getBaseItemLabelPosition, getBaseItemLabelVerticalAlignment, getBaseItemLabelVisible, getBorderPaints, getBorderStrokes, getChartArea, getColumnItemBorderPaint, getColumnItemBorderStroke, getColumnItemFillPaint, getColumnItemFillPaintTransformer, getColumnItemLabelDirection, getColumnItemLabelFont, getColumnItemLabelHorizontalAlignment, getColumnItemLabelPaint, getColumnItemLabelPosition, getColumnItemLabelVerticalAlignment, getDataset, getDrawingSupplier, getFillPaints, getItemBorderPaint, getItemBorderStroke, getItemFillPaint, getItemFillPaintHelper, getItemFillPaintTransformer, getItemLabelDirection, getItemLabelFont, getItemLabelHorizontalAlignment, getItemLabelPaint, getItemLabelPosition, getItemLabelVerticalAlignment, getLabelGenerator, getLegendItemCount, getLegendItemLabels, getLegendItemLabelsByColumn, getLegendItemLabelsByRow, getLegendItemShapes, getLegendPositon, getNegativeItemLabelHorizontalAlignment, getNegativeItemLabelVerticalAlignment, getPositiveItemLabelHorizontalAlignment, getPositiveItemLabelVerticalAlignment, getRenderAreaBorderPaint, getRenderAreaBorderStroke, getRowItemBorderPaint, getRowItemBorderStroke, getRowItemFillPaint, getRowItemFillPaintTransformer, getRowItemLabelDirection, getRowItemLabelFont, getRowItemLabelHorizontalAlignment, getRowItemLabelPaint, getRowItemLabelPosition, getRowItemLabelVerticalAlignment, getToolTipGenerator, hasListener, isAutoSelectBorderPaint, isAutoSelectBorderStroke, isAutoSelectFillPaint, isBaseItemDrawBorder, isBaseItemFill, isColumnItemDrawBorder, isColumnItemFill, isColumnItemLabelVisible, isColumnItemVisible, isGeneratorTooltip, isGeneratorUrl, isItemDrawBorder, isItemFill, isItemLabelVisible, isItemVisible, isRenderAreaBorderVisible, isRowItemDrawBorder, isRowItemFill, isRowItemLabelVisible, isRowItemVisible, notifyListeners, removeAllChangeListener, removeChangeListener, setAutoSelectBorderPaint, setAutoSelectBorderStroke, setAutoSelectFillPaint, setBackgroundImage, setBackgroundImageAlignment, setBackgroundImageAlpha, setBackgroundPaint, setBaseItemBorderPaint, setBaseItemBorderStroke, setBaseItemDrawBorder, setBaseItemFill, setBaseItemFillPaint, setBaseItemFillPaintTransformer, setBaseItemLabelDirection, setBaseItemLabelFont, setBaseItemLabelHorizontalAlignment, setBaseItemLabelPaint, setBaseItemLabelPosition, setBaseItemLabelVerticalAlignment, setBaseItemLabelVisible, setChartArea, setColumnItemBorderPaint, setColumnItemBorderStroke, setColumnItemDrawBorder, setColumnItemFill, setColumnItemFillPaint, setColumnItemFillPaintTransformer, setColumnItemLabelDirection, setColumnItemLabelFont, setColumnItemLabelHorizontalAlignment, setColumnItemLabelPaint, setColumnItemLabelPosition, setColumnItemLabelVerticalAlignment, setColumnItemLabelVisible, setColumnItemVisible, setCustomLegendType, setDataset, setDrawingSupplier, setDrawingSupplier, setGeneratorTooltip, setGeneratorUrl, setItemBorderPaint, setItemBorderStroke, setItemDrawBorder, setItemFill, setItemFillPaint, setItemFillPaintTransformer, setItemLabelDirection, setItemLabelFont, setItemLabelHorizontalAlignment, setItemLabelPaint, setItemLabelPosition, setItemLabelVerticalAlignment, setItemLabelVisible, setItemVisible, setLabelGenerator, setLegendPositon, setNegativeItemLabelHorizontalAlignment, setNegativeItemLabelVerticalAlignment, setPositiveItemLabelHorizontalAlignment, setPositiveItemLabelVerticalAlignment, setRenderAreaBorderPaint, setRenderAreaBorderStroke, setRenderAreaBorderVisible, setRowItemBorderPaint, setRowItemBorderStroke, setRowItemDrawBorder, setRowItemFill, setRowItemFillPaint, setRowItemFillPaintTransformer, setRowItemLabelDirection, setRowItemLabelFont, setRowItemLabelHorizontalAlignment, setRowItemLabelPaint, setRowItemLabelPosition, setRowItemLabelVerticalAlignment, setRowItemLabelVisible, setRowItemVisible, setToolTipGenerator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ijchart.xychart.render.IRender
addChangeListener, drawBackground, drawBackgroundImage, drawDrawAreaBorder, getBaseItemBorderPaint, getBaseItemBorderStroke, getBaseItemFillPaint, getBaseItemFillPaintTransformer, getBaseItemLabelFont, getBaseItemLabelHorizontalAlignment, getBaseItemLabelPaint, getBaseItemLabelPosition, getBaseItemLabelVerticalAlignment, getBaseItemLabelVisible, getColumnItemBorderPaint, getColumnItemBorderStroke, getColumnItemFillPaint, getColumnItemFillPaintTransformer, getColumnItemLabelFont, getColumnItemLabelHorizontalAlignment, getColumnItemLabelPaint, getColumnItemLabelPosition, getColumnItemLabelVerticalAlignment, getItemBorderPaint, getItemBorderStroke, getItemFillPaint, getItemFillPaintTransformer, getItemLabelFont, getItemLabelHorizontalAlignment, getItemLabelPaint, getItemLabelPosition, getItemLabelVerticalAlignment, getLabelGenerator, getNegativeItemLabelHorizontalAlignment, getNegativeItemLabelVerticalAlignment, getPositiveItemLabelHorizontalAlignment, getPositiveItemLabelVerticalAlignment, getRowItemBorderPaint, getRowItemBorderStroke, getRowItemFillPaint, getRowItemFillPaintTransformer, getRowItemLabelFont, getRowItemLabelHorizontalAlignment, getRowItemLabelPaint, getRowItemLabelPosition, getRowItemLabelVerticalAlignment, getToolTipGenerator, isBaseItemDrawBorder, isBaseItemFill, isColumnItemDrawBorder, isColumnItemFill, isColumnItemLabelVisible, isColumnItemVisible, isItemDrawBorder, isItemFill, isItemLabelVisible, isItemVisible, isRowItemDrawBorder, isRowItemFill, isRowItemLabelVisible, isRowItemVisible, removeAllChangeListener, removeChangeListener, setBaseItemBorderPaint, setBaseItemBorderStroke, setBaseItemDrawBorder, setBaseItemFill, setBaseItemFillPaint, setBaseItemFillPaintTransformer, setBaseItemLabelFont, setBaseItemLabelHorizontalAlignment, setBaseItemLabelPaint, setBaseItemLabelPosition, setBaseItemLabelVerticalAlignment, setBaseItemLabelVisible, setColumnItemBorderPaint, setColumnItemBorderStroke, setColumnItemDrawBorder, setColumnItemFill, setColumnItemFillPaint, setColumnItemFillPaintTransformer, setColumnItemLabelFont, setColumnItemLabelHorizontalAlignment, setColumnItemLabelPaint, setColumnItemLabelPosition, setColumnItemLabelVerticalAlignment, setColumnItemLabelVisible, setColumnItemVisible, setCustomLegendType, setItemBorderPaint, setItemBorderStroke, setItemDrawBorder, setItemFill, setItemFillPaint, setItemFillPaintTransformer, setItemLabelFont, setItemLabelHorizontalAlignment, setItemLabelPaint, setItemLabelPosition, setItemLabelVerticalAlignment, setItemLabelVisible, setItemVisible, setLabelGenerator, setNegativeItemLabelHorizontalAlignment, setNegativeItemLabelVerticalAlignment, setPositiveItemLabelHorizontalAlignment, setPositiveItemLabelVerticalAlignment, setRowItemBorderPaint, setRowItemBorderStroke, setRowItemDrawBorder, setRowItemFill, setRowItemFillPaint, setRowItemFillPaintTransformer, setRowItemLabelFont, setRowItemLabelHorizontalAlignment, setRowItemLabelPaint, setRowItemLabelPosition, setRowItemLabelVerticalAlignment, setRowItemLabelVisible, setRowItemVisible, setToolTipGenerator
 

Field Detail

DEFAULT_VOLUME_PAINT

public static final transient java.awt.Paint DEFAULT_VOLUME_PAINT
The default paint used to fill the volume bars.


DEFAULT_UP_PAINT

public static final transient java.awt.Paint DEFAULT_UP_PAINT
The default paint used to fill the shape when the price moved up from open to close.


DEFAULT_DOWN_PAINT

public static final transient java.awt.Paint DEFAULT_DOWN_PAINT
The default paint used to fill the shape when the price moved down from open to close.


DEFAULT_AUTO_WIDTH_FACTOR

public static final double DEFAULT_AUTO_WIDTH_FACTOR
The default factor for calculate shape width.

See Also:
Constant Field Values

DEFAULT_MAX_SHAPE_WIDTH_IN_PERCENT

public static final double DEFAULT_MAX_SHAPE_WIDTH_IN_PERCENT
The default maximum width of the graphic to percentage of axis length.

See Also:
Constant Field Values
Constructor Detail

StockRender

public StockRender(SingleRowDataset dataset)
The constructor.

Parameters:
dataset - SingleRowDataset The dataset (null not permitted).

StockRender

public StockRender(SingleRowDataset dataset,
                   double shapeWidth)
The constructor.

Parameters:
dataset - SingleRowDataset The dataset (null not permitted).
shapeWidth - double The shape width.

StockRender

public StockRender(SingleRowDataset dataset,
                   double shapeWidth,
                   boolean drawVolume)
The constructor.

Parameters:
dataset - SingleRowDataset The dataset (null not permitted).
shapeWidth - double The shape width.
drawVolume - double A flag indicating whether or not volume bars should be drawn.
Method Detail

getShapeWidth

public double getShapeWidth()
Returns the shape width.

Returns:
double The shape width.

setShapeWidth

public void setShapeWidth(double width)
Sets the shape width and sends a RenderChangeEvent to all registered listeners.

Parameters:
width - double The shape width.

getAutoWidthFactor

public double getAutoWidthFactor()
Returns the factor for calculate shape width.

Returns:
double The width factor (generally between 0.0 and 1.0).

setAutoWidthFactor

public void setAutoWidthFactor(double factor)
Sets the factor for calculate shape width.

Parameters:
factor - double The width factor (generally between 0.0 and 1.0).

getAutoWidthGap

public double getAutoWidthGap()
Returns the minimum gap between one shape and the next.

Returns:
double The gap.

setAutoWidthGap

public void setAutoWidthGap(double autoWidthGap)
Sets the minimum gap between one shape and the next and sends a RenderChangeEvent to all registered listeners.

Parameters:
autoWidthGap - double The gap.

getUpPaint

public java.awt.Paint getUpPaint()
Returns the paint used to fill the shape when the price moved up from open to close.

Returns:
Paint The paint (possibly null).

setUpPaint

public void setUpPaint(java.awt.Paint paint)
Sets the paint used to fill the shape when the price moved up from open to close,and sends a RenderChangeEvent to all registered listeners.

Parameters:
paint - Paint The paint (null permitted).

getDownPaint

public java.awt.Paint getDownPaint()
Returns the paint used to fill the shape when the price moved down from open to close.

Returns:
Paint The paint (possibly null).

setDownPaint

public void setDownPaint(java.awt.Paint paint)
Sets the paint used to fill the shape when the price moved down from open to close,and sends a RenderChangeEvent to all registered listeners.

Parameters:
paint - Paint The paint (null permitted).

isDrawVolume

public boolean isDrawVolume()
Returns whether or not volume bars are drawn on the chart.

Returns:
boolean A boolean.

setDrawVolume

public void setDrawVolume(boolean flag)
Sets the flag controlling whether or not volume bars are drawn on the chart and sends a RenderChangeEvent to all registered listeners.

Parameters:
flag - boolean The flag.

getVolumePaint

public java.awt.Paint getVolumePaint()
Returns the paint used to fill the volume bars (if they are visible).

Returns:
The paint (possibly null).

setVolumePaint

public void setVolumePaint(java.awt.Paint paint)
Sets the paint used to fill the volume bars (if they are visible) and sends a RenderChangeEvent to all registered listeners.

Parameters:
paint - Paint The paint (null not permitted).

getMaxShapeWidthInPercent

public double getMaxShapeWidthInPercent()
Returns the default maximum width of the graphic to percentage of axis length.

Returns:
double The percent.

setMaxShapeWidthInPercent

public void setMaxShapeWidthInPercent(double percent)
The default maximum width of the graphic to percentage of axis length,and sends a RenderChangeEvent to all registered listeners.

Parameters:
percent - double The percent.

drawAllItems

public void drawAllItems(AbstractValueAxis xAxis,
                         RectangleEdge xAxisEdge,
                         AbstractValueAxis yAxis,
                         RectangleEdge yAxisEdge,
                         java.awt.geom.Rectangle2D dataArea,
                         ChartOrientation orientation,
                         RenderShapeCollection renderShapes,
                         float alpha)
Draws all data items.

Specified by:
drawAllItems in class AbstractXYRender
Parameters:
xAxis - AbstractValueAxis The x value axis (null not permitted).
xAxisEdge - RectangleEdge The x axis edge.
yAxis - AbstractValueAxis The y value axis (null not permitted).
yAxisEdge - RectangleEdge The y axis edge (null not permitted).
dataArea - Rectangle2D The chart data area (null not permitted).
orientation - ChartOrientation The chart orientation (null not permitted).
renderShapes - RenderShapeCollection Collects information about the render (null not permitted).
alpha - float The alpha transparency (in the range 0.0f to 1.0f, where 0.0f is fully transparent, and 1.0f is fully opaque).

getLegendType

public LegendType getLegendType()
Return the legend type.

Specified by:
getLegendType in interface IRender
Overrides:
getLegendType in class AbstractRender
Returns:
LegendType The legend type.

createItemShapeOnly

protected IChartShape createItemShapeOnly(java.awt.geom.Rectangle2D rect,
                                          java.lang.String text,
                                          java.lang.Object appendParam)
Create a shape with no attribute specified.

Overrides:
createItemShapeOnly in class AbstractRender
Parameters:
rect - Rectangle2D The bar rectangle (null not permitted).
text - String The text (null permitted).
appendParam - Object The append parameter,used for special propose (null permitted).
Returns:
IChartShape The shape.

equals

public boolean equals(java.lang.Object obj)
Indicates if some other object is "equal to" this one.

Overrides:
equals in class AbstractXYRender
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

hashCode

public int hashCode()
Returns a hash code value for the object.

Overrides:
hashCode in class AbstractXYRender
Returns:
int A hash code value for this object.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Creates and returns a copy of this object.

Overrides:
clone in class AbstractXYRender
Returns:
object a clone of this instance.
Throws:
java.lang.CloneNotSupportedException - if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class AbstractXYRender
Returns:
a string representation of the object.