Venice 0.751beta

nz.org.venice.chart.graph
Class CustomGraph

java.lang.Object
  extended bynz.org.venice.chart.graph.AbstractGraph
      extended bynz.org.venice.chart.graph.CustomGraph
All Implemented Interfaces:
Graph

public class CustomGraph
extends AbstractGraph

Graph a Gondola expression. This graph allows the user to construct and graph custom indicators.

Author:
Andrew Leppard
See Also:
CustomGraphUI, Expression

Field Summary
 
Fields inherited from interface nz.org.venice.chart.graph.Graph
TOOL_TIP_BUFFER
 
Constructor Summary
CustomGraph(GraphSource source, Symbol symbol, EODQuoteBundle quoteBundle)
          Create a new custom graph.
CustomGraph(GraphSource source, Symbol symbol, EODQuoteBundle quoteBundle, java.util.HashMap settings)
          Create a new custom graph.
 
Method Summary
static Graphable createCustom(Expression indicator, Graphable source, EODQuoteBundle quoteBundle, Symbol symbol)
          Create a new custom graph based on the given graph source and quote bundle.
 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.
 GraphUI getUI(java.util.HashMap settings)
          Return the graph's user interface.
 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 topLineValue, double bottomLineValue, java.util.List xRange, boolean vertOrientation)
          Draw the graph.
 void setSettings(java.util.HashMap settings)
          Set the graph's user definable settings.
 
Methods inherited from class nz.org.venice.chart.graph.AbstractGraph
dataAvailable, getAcceptableMajorDeltas, getAcceptableMinorDeltas, getEndX, getSettings, getSource, getSourceName, getSourceType, getStartX, getToolTipText, getXRange, getY, getYLabel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CustomGraph

public CustomGraph(GraphSource source,
                   Symbol symbol,
                   EODQuoteBundle quoteBundle)
Create a new custom graph. Currently this class requires both a graph source and a quote bundle. The quote bundle argument will soon become deprecated and the function will require five graph sources - one for day open, close, low high and volume. This change will enable us to run equations on arbitrary indeces (i.e. groups of stocks).

Parameters:
source - the source containing the dates to work with
symbol - the symbol to apply the expression
quoteBundle - the quote bundle containing the quotes

CustomGraph

public CustomGraph(GraphSource source,
                   Symbol symbol,
                   EODQuoteBundle quoteBundle,
                   java.util.HashMap settings)
Create a new custom graph. Currently this class requires both a graph source and a quote bundle. The quote bundle argument will soon become deprecated and the function will require five graph sources - one for day open, close, low high and volume. This change will enable us to run equations on arbitrary indeces (i.e. groups of stocks).

Parameters:
source - the source containing the dates to work with
symbol - the symbol to apply the expression
quoteBundle - the quote bundle containing the quotes
settings - the settings for the graph
Method Detail

render

public void render(java.awt.Graphics g,
                   java.awt.Color colour,
                   int xoffset,
                   int yoffset,
                   double horizontalScale,
                   double verticalScale,
                   double topLineValue,
                   double bottomLineValue,
                   java.util.List xRange,
                   boolean vertOrientation)
Description copied from interface: Graph
Draw the 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
topLineValue - the Y value of the lowest line in the graph
bottomLineValue - the Y value of the lowest line in the graph
xRange - a List of Comparable that contain the X values to plot
vertOrientation - true if increasing y values mean decreasing Y values

getHighestY

public double getHighestY(java.util.List x)
Description copied from class: AbstractGraph
Return the highest Y value in the given X range.

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

getLowestY

public double getLowestY(java.util.List x)
Description copied from class: AbstractGraph
Return the loweset Y value in the given X range.

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

createCustom

public static Graphable createCustom(Expression indicator,
                                     Graphable source,
                                     EODQuoteBundle quoteBundle,
                                     Symbol symbol)
Create a new custom graph based on the given graph source and quote bundle. This function calls the method with the same name in CustomGraphUI.

Parameters:
indicator - the custom indicator expression
source - the source containing the dates to work with
symbol - the symbol to apply the expression
quoteBundle - the quote bundle containing the quotes
Returns:
the custom graph
Throws:
EvaluationException - if there was an error evaluating the equation

setSettings

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

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

getUI

public GraphUI getUI(java.util.HashMap settings)
Return the graph's user interface.

Specified by:
getUI in interface Graph
Overrides:
getUI in class AbstractGraph
Parameters:
settings - the initial settings
Returns:
user interface

getName

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

Returns:
Custom

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.

Returns:
true if the graph is a primary graph

Venice 0.751beta