Package org.jfree.chart.renderer.xy
Class HighLowRenderer
java.lang.Object
org.jfree.chart.renderer.AbstractRenderer
org.jfree.chart.renderer.xy.AbstractXYItemRenderer
org.jfree.chart.renderer.xy.HighLowRenderer
- All Implemented Interfaces:
Serializable,Cloneable,EventListener,AnnotationChangeListener,LegendItemSource,XYItemRenderer,PublicCloneable
public class HighLowRenderer
extends AbstractXYItemRenderer
implements XYItemRenderer, Cloneable, PublicCloneable, Serializable
A renderer that draws high/low/open/close markers on an

XYPlot
(requires a OHLCDataset). This renderer does not include code to
calculate the crosshair point for the plot.
The example shown here is generated by the HighLowChartDemo1.java
program included in the JFreeChart Demo Collection:

- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate PaintThe paint used for the close ticks (ifnull, the series paint is used instead).private booleanA flag that controls whether the close ticks are drawn.private booleanA flag that controls whether the open ticks are drawn.private PaintThe paint used for the open ticks (ifnull, the series paint is used instead).private static final longFor serialization.private doubleThe tick length (in Java2D units).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 -
Method Summary
Modifier and TypeMethodDescriptionclone()Returns a clone of the renderer.voiddrawItem(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.booleanTests this renderer for equality with an arbitrary object.findRangeBounds(XYDataset dataset) Returns the range of values the renderer requires to display all the items from the specified dataset.Returns the paint used to draw the ticks for the close values.booleanReturns the flag that controls whether close ticks are drawn.booleanReturns the flag that controls whether open ticks are drawn.Returns the paint used to draw the ticks for the open values.doubleReturns the tick length (in Java2D units).private voidreadObject(ObjectInputStream stream) Provides serialization support.voidsetCloseTickPaint(Paint paint) Sets the paint used to draw the ticks for the close values and sends aRendererChangeEventto all registered listeners.voidsetDrawCloseTicks(boolean draw) Sets the flag that controls whether close ticks are drawn, and sends aRendererChangeEventto all registered listeners.voidsetDrawOpenTicks(boolean draw) Sets the flag that controls whether open ticks are drawn, and sends aRendererChangeEventto all registered listeners.voidsetOpenTickPaint(Paint paint) Sets the paint used to draw the ticks for the open values and sends aRendererChangeEventto all registered listeners.voidsetTickLength(double length) Sets the tick length (in Java2D units) and sends aRendererChangeEventto all registered listeners.private voidwriteObject(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, initialise, lineTo, moveTo, removeAnnotation, removeAnnotations, setDefaultItemLabelGenerator, setDefaultToolTipGenerator, setLegendItemLabelGenerator, setLegendItemToolTipGenerator, setLegendItemURLGenerator, setPlot, setSeriesItemLabelGenerator, setSeriesToolTipGenerator, setURLGenerator, updateCrosshairValuesMethods 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, setTreatLegendShapeAsLineMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jfree.chart.LegendItemSource
getLegendItemsMethods 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, initialise, 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 Details
-
serialVersionUID
private static final long serialVersionUIDFor serialization.- See Also:
-
drawOpenTicks
private boolean drawOpenTicksA flag that controls whether the open ticks are drawn. -
drawCloseTicks
private boolean drawCloseTicksA flag that controls whether the close ticks are drawn. -
openTickPaint
The paint used for the open ticks (ifnull, the series paint is used instead). -
closeTickPaint
The paint used for the close ticks (ifnull, the series paint is used instead). -
tickLength
private double tickLengthThe tick length (in Java2D units).
-
-
Constructor Details
-
HighLowRenderer
public HighLowRenderer()The default constructor.
-
-
Method Details
-
getDrawOpenTicks
public boolean getDrawOpenTicks()Returns the flag that controls whether open ticks are drawn.- Returns:
- A boolean.
- See Also:
-
setDrawOpenTicks
public void setDrawOpenTicks(boolean draw) Sets the flag that controls whether open ticks are drawn, and sends aRendererChangeEventto all registered listeners.- Parameters:
draw- the flag.- See Also:
-
getDrawCloseTicks
public boolean getDrawCloseTicks()Returns the flag that controls whether close ticks are drawn.- Returns:
- A boolean.
- See Also:
-
setDrawCloseTicks
public void setDrawCloseTicks(boolean draw) Sets the flag that controls whether close ticks are drawn, and sends aRendererChangeEventto all registered listeners.- Parameters:
draw- the flag.- See Also:
-
getOpenTickPaint
Returns the paint used to draw the ticks for the open values.- Returns:
- The paint used to draw the ticks for the open values (possibly
null). - See Also:
-
setOpenTickPaint
Sets the paint used to draw the ticks for the open values and sends aRendererChangeEventto all registered listeners. If you set this tonull(the default), the series paint is used instead.- Parameters:
paint- the paint (nullpermitted).- See Also:
-
getCloseTickPaint
Returns the paint used to draw the ticks for the close values.- Returns:
- The paint used to draw the ticks for the close values (possibly
null). - See Also:
-
setCloseTickPaint
Sets the paint used to draw the ticks for the close values and sends aRendererChangeEventto all registered listeners. If you set this tonull(the default), the series paint is used instead.- Parameters:
paint- the paint (nullpermitted).- See Also:
-
getTickLength
public double getTickLength()Returns the tick length (in Java2D units).- Returns:
- The tick length.
- See Also:
-
setTickLength
public void setTickLength(double length) Sets the tick length (in Java2D units) and sends aRendererChangeEventto all registered listeners.- Parameters:
length- the length.- See Also:
-
findRangeBounds
Returns the range of values the renderer requires to display all the items from the specified dataset.- Specified by:
findRangeBoundsin interfaceXYItemRenderer- Overrides:
findRangeBoundsin classAbstractXYItemRenderer- Parameters:
dataset- the dataset (nullpermitted).- Returns:
- The range (
nullif the dataset isnullor empty). - See Also:
-
drawItem
public 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.- Specified by:
drawItemin interfaceXYItemRenderer- Parameters:
g2- the graphics device.state- the renderer state.dataArea- the area within which the plot is being drawn.info- collects information 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 (nullpermitted).pass- the pass index.
-
clone
Returns a clone of the renderer.- Specified by:
clonein interfacePublicCloneable- Overrides:
clonein classAbstractXYItemRenderer- Returns:
- A clone.
- Throws:
CloneNotSupportedException- if the renderer cannot be cloned.
-
equals
Tests this renderer for equality with an arbitrary object.- Overrides:
equalsin classAbstractXYItemRenderer- Parameters:
obj- the object (nullpermitted).- Returns:
- A boolean.
-
readObject
Provides serialization support.- Parameters:
stream- the input stream.- Throws:
IOException- if there is an I/O error.ClassNotFoundException- if there is a classpath problem.
-
writeObject
Provides serialization support.- Parameters:
stream- the output stream.- Throws:
IOException- if there is an I/O error.
-