Venice 0.7beta

org.mov.chart.graph
Class AdvanceDeclineGraph

java.lang.Object
  extended by org.mov.chart.graph.AdvanceDeclineGraph
All Implemented Interfaces:
Graph

public class AdvanceDeclineGraph
extends java.lang.Object
implements Graph

Advance/Decline graph. This graphs the Advance/Decline market indicator. This graph is used to indicate whether trends in the market are short or long lived. If the market is going up and the advance/decline line is going down, there is something wrong.


Field Summary
 
Fields inherited from interface org.mov.chart.graph.Graph
TOOL_TIP_BUFFER
 
Constructor Summary
AdvanceDeclineGraph()
          Create a new Advance/Decline graph.
 
Method Summary
static Graphable createAdvanceDecline()
          Create Advance/Decline graphable.
 double[] getAcceptableMajorDeltas()
          Return an array of acceptable major deltas for the vertical axis.
 double[] getAcceptableMinorDeltas()
          Return an array of acceptable minor deltas for the vertical axis.
 java.util.HashMap getAnnotations()
          Return the annotations for this graph or null if it does not have any.
 java.lang.Comparable getEndX()
          Get the last X value that this graph will draw.
 double getHighestY(java.util.List x)
          Return the highest Y value in the given X range.
 double getLowestY(java.util.List x)
          Return the loweset Y value in the given X range.
 java.lang.String getName()
          Return the name of this graph.
 java.util.HashMap getSettings()
          Return the graph's current settings.
 java.lang.String getSourceName()
          Return the name of the source data that we are graphing, e.g.
 java.lang.Comparable getStartX()
          Get the first X value that this graph will draw.
 java.lang.String getToolTipText(java.lang.Comparable x, int y, int yoffset, double verticalScale, double bottomLineValue)
          Get the tool tip text for the given X value and y coordinate.
 GraphUI getUI(java.util.HashMap settings)
          Return the graph's user interface to allow the user to modify its settings.
 java.util.Set getXRange()
          Get all X values that this graph will draw.
 java.lang.Double getY(java.lang.Comparable x)
          Return the Y value for the given X value.
 java.lang.String getYLabel(double value)
          Convert the Y value to a label to be displayed in the vertical axis.
 boolean hasAnnotations()
          Return if this graph has any annotations.
 boolean isPrimary()
          Return whether the graph is a primary graph.
 void render(java.awt.Graphics g, java.awt.Color colour, int xoffset, int yoffset, double horizontalScale, double verticalScale, double bottomLineValue, java.util.List xRange)
          Draw the graph.
 void setSettings(java.util.HashMap settings)
          Set the graph's user definable settings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdvanceDeclineGraph

public AdvanceDeclineGraph()
Create a new Advance/Decline graph.

Method Detail

render

public void render(java.awt.Graphics g,
                   java.awt.Color colour,
                   int xoffset,
                   int yoffset,
                   double horizontalScale,
                   double verticalScale,
                   double bottomLineValue,
                   java.util.List xRange)
Description copied from interface: Graph
Draw the graph.

Specified by:
render in interface Graph
Parameters:
g - the Graphics object to render to
colour - the colour the graph should be rendered in; override this if the graph should be drawn in a certain colour - such as a Moving Average graph
xoffset - the x offset in the graphics object where the graph starts
yoffset - the y offset in the graphics object where the graph starts
horizontalScale - horizontal scale factor; use this to convert between X value in the xRange to a cartesian coordinate x
verticalScale - vertical scale factor; use this to convert between Y value to a cartesian coordinate y
bottomLineValue - the Y value of the lowest line in the graph
xRange - a List of Comparable that contain the X values to plot

getToolTipText

public java.lang.String getToolTipText(java.lang.Comparable x,
                                       int y,
                                       int yoffset,
                                       double verticalScale,
                                       double bottomLineValue)
Description copied from interface: Graph
Get the tool tip text for the given X value and y coordinate.

Specified by:
getToolTipText in interface Graph
Parameters:
x - the X value
y - the y coordinate
yoffset - y offset from top of graph
verticalScale - vertical scale factor
bottomLineValue - the Y value of the lowest line in the graph
Returns:
the tooltip text

getStartX

public java.lang.Comparable getStartX()
Get the first X value that this graph will draw.

Specified by:
getStartX in interface Graph
Returns:
X value of the first x coordinate in the default GraphSource's Graphable

getEndX

public java.lang.Comparable getEndX()
Get the last X value that this graph will draw.

Specified by:
getEndX in interface Graph
Returns:
X value of the last x coordinate in the default GraphSource's Graphable

getXRange

public java.util.Set getXRange()
Get all X values that this graph will draw.

Specified by:
getXRange in interface Graph
Returns:
X values in the default GraphSource's Graphable

getYLabel

public java.lang.String getYLabel(double value)
Convert the Y value to a label to be displayed in the vertical axis.

Specified by:
getYLabel in interface Graph
Parameters:
value - y value
Returns:
the Y label text that the default GraphSource would display

getY

public java.lang.Double getY(java.lang.Comparable x)
Return the Y value for the given X value.

Specified by:
getY in interface Graph
Parameters:
x - value
Returns:
Y value of the default GraphSource

getHighestY

public double getHighestY(java.util.List x)
Return the highest Y value in the given X range.

Specified by:
getHighestY in interface Graph
Parameters:
x - range of X values
Returns:
the highest Y value of the default GraphSource

getLowestY

public double getLowestY(java.util.List x)
Return the loweset Y value in the given X range.

Specified by:
getLowestY in interface Graph
Parameters:
x - range of X values
Returns:
the lowest Y value of the default GraphSource

getAcceptableMajorDeltas

public double[] getAcceptableMajorDeltas()
Return an array of acceptable major deltas for the vertical axis.

Specified by:
getAcceptableMajorDeltas in interface Graph
Returns:
an array of doubles representing the minor deltas of the default GraphSource

getAcceptableMinorDeltas

public double[] getAcceptableMinorDeltas()
Return an array of acceptable minor deltas for the vertical axis.

Specified by:
getAcceptableMinorDeltas in interface Graph
Returns:
an array of doubles representing the minor deltas of the default GraphSource
See Also:
Graph.getAcceptableMajorDeltas()

getAnnotations

public java.util.HashMap getAnnotations()
Return the annotations for this graph or null if it does not have any. The annotations should be in a map of X values to String values.

Returns:
map of annotations

hasAnnotations

public boolean hasAnnotations()
Return if this graph has any annotations.

Returns:
true if this graph has annotations; false otherwise

createAdvanceDecline

public static Graphable createAdvanceDecline()
Create Advance/Decline graphable.


getSettings

public java.util.HashMap getSettings()
Description copied from interface: Graph
Return the graph's current settings. Each graph must contain its user definable settings in a hashmap. If a graph does not have any user definable settings, then it can just return an empty hashmap here.

Specified by:
getSettings in interface Graph
Returns:
settings

setSettings

public void setSettings(java.util.HashMap settings)
Description copied from interface: Graph
Set the graph's user definable settings.

Specified by:
setSettings in interface Graph
Parameters:
settings - the new settings

getUI

public GraphUI getUI(java.util.HashMap settings)
Description copied from interface: Graph
Return the graph's user interface to allow the user to modify its settings. Pass the initial settings or an empty hashmap to use the graph's default settings. If the graph does not have any user-definable settings, then it should not have a user interface and should return null here.

Specified by:
getUI in interface Graph
Parameters:
settings - initial settings
Returns:
user interface or null

getName

public java.lang.String getName()
Return the name of this graph.

Specified by:
getName in interface Graph
Returns:
Advance/Decline

getSourceName

public java.lang.String getSourceName()
Description copied from interface: Graph
Return the name of the source data that we are graphing, e.g. CBA.

Specified by:
getSourceName in interface Graph
Returns:
the name of the source

isPrimary

public boolean isPrimary()
Description copied from interface: Graph
Return whether the graph is a primary graph. Primary graphs will appear together in the top chart. Secondary graphs appear in their own charts which are added below. The day close graph is primary; while the day close graph is secondary.

Specified by:
isPrimary in interface Graph
Returns:
true if the graph is a primary graph

Venice 0.7beta